DomDocument::loadXml not throwing exceptions in PHP

Double quote marks For some reason, Zend have decided not to make PHP throw an exception when you try and load invalid XML into a DomDocument object... which is annoying. Double quote marks

For some reason, Zend have decided not to make PHP throw an exception when you try and load invalid XML into a DomDocument object. This includes XML with invalid characters e.g. &. This means wrapping a try/catch around anything does absolutely no good whatsoever, which is annoying.

Is there a good way of trapping runtime errors using loadXml with the DomDocument library?

Leave a Reply

* indicates required field.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>