DOMDocument->createElementNS()
Create new element node with an associated namespace
&reftitle.description;
DOMDocument
DOMElementcreateElementNS
stringnamespaceURI
stringqualifiedName
stringvalue
This function creates a new element node with an associated namespace.
&dom.node.inserted;
&reftitle.parameters;
namespaceURI
The URI of the namespace.
qualifiedName
The qualified name of the element, as prefix:tagname.
value
The value of the element. By default, an empty element will be created.
You can also set the value later with DOMElement->nodeValue.
&reftitle.returnvalues;
The new DOMElement or &false; if an error occured.
&reftitle.exceptions;
DOM_INVALID_CHARACTER_ERR
Raised if qualifiedName contains an invalid character.
DOM_NAMESPACE_ERR
Raised if qualifiedName is a maformed qualified
name.
&reftitle.examples;
Creating a new element and inserting it as root
createElementNS('http://www.example.com/XFoo', 'xfoo:test', 'This is the root element!');
// We insert the new element as root (child of the document)
$dom->appendChild($element);
echo $dom->saveXML();
?>
]]>
&example.outputs;
This is the root element!
]]>
&reftitle.seealso;