getting ERROR info from DOMXML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Terence

    getting ERROR info from DOMXML

    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.

Working...