List Info

Thread: note 53195 deleted from function.dom-domdocument-loadxml by nlopess




note 53195 deleted from function.dom-domdocument-loadxml by nlopess
user name
2007-06-26 16:15:59
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


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )