note 65295 deleted from function.simplexml-load-string by bjori
| From: | bjori@php.net | Date: | Fri, 28 Apr 2006 13:16:55 +0000 |
| Subject: | note 65295 deleted from function.simplexml-load-string by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109977@lists.php.net to get a copy of this message | ||
Note Submitter: James
Reason: bad code
----
simplexml_load_string and simplexml_load_file are quite strict with the formatting of the xml. For
example each 'tag' in the xml must start on a new line. To get around this, first create
a dom object and then import the dom object into simpleXML:
<?php
$dom = new DomDocument();
if (!($dom->loadXML($xmlstring))) {
# problem with the xml formatting
}
# Now import the dom into simplexml
$xml = simplexml_import_dom($dom);
?>
XML that simpleXML has rejected can sometimes be loaded by DOM.