By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

getting ERROR info from DOMXML

P: n/a
The XML (expat) extension to PHP contains specific functions for
accessing detailed error information when an error occurs parsing an XML
packet. All be it convoluted, even the XSLT (Sablotron) extension will
provide access to detailed error information.

I can't seem to figure out how to access this information in DOMXML

Does anyone have and light to shed on this aspect?

__more info_____________________________________________

I'm trying to write a high-level API for something and I want to access
detailed error information in order to handle exceptions gracefully.

After purposfully deleting a ">" from a closing <head> tag, I get the
following error

__error output__________________________________________

Warning: domxml_open_mem(): Entity: line 18: in la_la_la.php on line 203

Warning: domxml_open_mem(): error: in la_la_la.php on line 203

Warning: domxml_open_mem(): End tag : expected '>' in la_la_la.php on
line 203

Warning: domxml_open_mem(): <body> in la_la_la.php on line 203

Warning: domxml_open_mem(): ^ in la_la_la.php on line 203
__________________________________________________ ______

Aside from the fact that these only show up if error reporting levels
include "warnings", there is also the posibility that logging goes to a
file and not the browser. So obviously I cannot use output buffering to
trap error output and re-hash it. Also, $php_errormsg requires
track_errors to be turned on in the INI file - so I can't rely on this.

It seems to me that the underlying library is trying to say
"Entity [on] line 18 [has the following] error:
End tag expected '>' in [the] <body> [element]."

Obviously libxml has the detail I need but it's being blocked from
access due to the PHP implementation of it libxml.

I realise that the DOMXML extension is [perpetually?] EXPERIMENTAL but I
was hoping that there would still be a sane way to access error info.

Jul 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.