note 65295 added to function.simplexml-load-string
| From: | James at osu1 dot php dot net | Date: | Fri, 28 Apr 2006 10:49:27 +0000 |
| Subject: | note 65295 added to function.simplexml-load-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-109951@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 66.163.161.117
Probable Submitter: 165.146.119.231
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.simplexml-load-string.php
Edit -- http://master.php.net/note/edit/65295
Del: integrated -- http://master.php.net/note/delete/65295/integrated
Del: useless -- http://master.php.net/note/delete/65295/useless
Del: bad code -- http://master.php.net/note/delete/65295/bad+code
Del: spam -- http://master.php.net/note/delete/65295/spam
Del: non-english -- http://master.php.net/note/delete/65295/non-english
Del: in docs -- http://master.php.net/note/delete/65295/in+docs
Del: other reasons-- http://master.php.net/note/delete/65295
Reject -- http://master.php.net/note/reject/65295
Search -- http://master.php.net/manage/user-notes.php