note 53195 deleted from function.dom-domdocument-loadxml by nlopess
| From: | nlopess@php.net | Date: | Tue, 26 Jun 2007 21:15:59 +0000 |
| Subject: | note 53195 deleted from function.dom-domdocument-loadxml by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-128000@lists.php.net to get a copy of this message | ||
Note Submitter: blaine at blainegarrett dot com
----
It seems this method does not throw a DOMException if it fails, but rather a regular warning. Thus
it makes it hard to fine tune strings to try to get them to be valid XML.
Ideally, there would be a way to figure out why loadXML failed (by way of the exception), but rather
only an warning is displayed. This is a heads up for anyone trying to write their own
string_to_xml() functions.
$string = '$$$"$$"&&&&Ålesund';
try {
$dom = DOMDocument::loadXML($test_string);
}
catch(DOMException $e) {
echo '<pre>';
print_r($e);
echo '</pre>';
}
Blaine
http://blainegarrett.com