|
DOMDocument::createElementCreate new element node Description
public DOMElementfalse DOMDocument::createElement(string
$localName , string $value = "")This function creates a new instance of class DOMElement. This node will not show up in the document unless it is inserted with (e.g.) DOMNode::appendChild. Parameters
Return Values
Returns a new instance of class 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"?> <test>This is the root element!</test>
Example #2 Passing text containing an unescaped & as
The above example will output something similar to: Warning: DOMDocument::createElement(): unterminated entity reference you in /in/BjTCg on line 4 <?xml version="1.0" encoding="utf-8"?> <foo/> Notes
See Also
|