(PHP 5, PHP 7, PHP 8)
DOMDocument::loadXML — Load XML from a string
Loads an XML document from a string.
Throws a ValueError if source
is an empty string.
| Version | Description |
|---|---|
| 8.3.0 | This function now has a tentative bool return type. |
| 8.0.0 |
Passing an empty string as source now throws a
ValueError; previously, an E_WARNING
was raised and false was returned.
|
| 8.0.0 |
Calling this function statically will
now throw an Error.
Previously, an E_DEPRECATED was raised.
|
Example #1 Creating a Document
<?php
$doc = new DOMDocument();
$doc->loadXML('<root><node/></root>');
echo $doc->saveXML();
?>