|
DOMDocument::createElementNSCreate new element node with an associated namespace Description
public DOMElementfalse DOMDocument::createElementNS(stringnull
$namespace , string $qualifiedName , string $value = "")This function creates a new element node with an associated namespace. This node will not show up in the document unless it is inserted with (e.g.) DOMNode::appendChild. Parameters
Return Values
The new DOMElement or Errors/Exceptions
Examples
Example #1 Creating a new element and inserting it as root
The above example will output: <?xml version="1.0" encoding="utf-8"?> <xfoo:test xmlns:xfoo="http://www.example.com/XFoo">This is the root element!</xfoo:test> Example #2 A namespace prefix example
The above example will output: <?xml version="1.0" encoding="utf-8"?> <element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0"> <g:item_type>house</g:item_type> </element> http://base.google.com/ns/1.0 g item_type See Also
|