DOMDocument::loadXML
(PHP 5)
DOMDocument::loadXML — Load XML from a string
Beschreibung
Loads an XML document from a string.
Parameter-Liste
-
source -
The string containing the XML.
-
options -
Bitwise OR of the libxml option constants.
Rückgabewerte
Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben. If called statically, returns a
DOMDocumentIm Fehlerfall wird FALSE zurückgegeben..
Fehler/Exceptions
If an empty string is passed as the source,
a warning will be generated. This warning is not generated by libxml
and cannot be handled using libxml's error handling functions.
Diese Methode kann statisch aufgerufen werden, dies wird aber einen E_STRICT-Fehler hervorrufen.
Beispiele
Beispiel #1 Creating a Document
<?php
$doc = new DOMDocument();
$doc->loadXML('<root><node/></root>');
echo $doc->saveXML();
?>
Beispiel #2 Static invocation of loadXML
<?php
// Issues an E_STRICT error
$doc = DOMDocument::loadXML('<root><node/></root>');
echo $doc->saveXML();
?>
Siehe auch
- DOMDocument::load() - Load XML from a file
- DOMDocument::save() - Dumps the internal XML tree back into a file
- DOMDocument::saveXML() - Dumps the internal XML tree back into a string
DOMDocument::loadXML