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
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|