(PHP 5, PHP 7, PHP 8)
DOMDocument::loadXML — Load XML from a string
$source
$options
Loads an XML document from a string.
source
The string containing the XML.
options
Bitwise OR of the libxml option constants.
OR
Returns true on success or false on failure.
true
false
Throws a ValueError if source is an empty string.
E_WARNING
E_DEPRECATED
Example #1 Creating a Document
<?php $doc = new DOMDocument(); $doc->loadXML('<root><node/></root>'); echo $doc->saveXML(); ?>