Re: [xml] Missing line numbers in error handling (somewhat of a repeat of a 2002 post)



On Thu, Mar 25, 2004 at 10:04:08AM -0800, David Ascher wrote:
I'm exploring using libxml to do validating parsing in an IDE (Komodo), 
using the Python bindings.  It seems to work just fine, but I have two 
problems:

1) Small problem: it seems to be that the error handler is called once 
per line of 'error output' as opposed to being called once per error w/ 
multiline outputs, which makes parsing the error programmatically a tad
harder.

  See the new structured error functions
    http://xmlsoft.org/html/libxml-xmlerror.html
Stephane Bidoul provided support for those a the Python level, e.g.
the tstLastError.py example in the python subdir.

2) Bigger problem: it seems that some errors display line numbers in the 
error messages:

      Entity: line 9:
      parser
      error :
      Opening and ending tag mismatch: foo line 7 and bodyasdas
      
      </bodyasdas>
      
                  ^

but many aren't:

      element bodyasdas:
      validity
      error :
      No declaration for element bodyasdas
      
      </bodyasdas>
      
                  ^
      
      element html:
      validity
      error :
      Element html content does not follow the DTD, expecting (head ,
      body), got (head bodyasdas )

      </html>
      
             ^

My questions are:

0) is there a reason for the line-by-line error reporting rather than 
error-by-error reporting?  (or is it a python binding specific bug?)

  historical, use the new APIs instead

1) is the lack of consistent line numbers a bug, or rather a bug you 
care about?

  usually there is line numbers. Sometimes you can't have line numbers.
In general we try to provide them, so you may have found a bug but your
post is not explicit enough to confirm this.

2) how hard would it be to fix, and if not impossible, any pointers on 
where I should look in the code?

  "how hard" can't be answered since we don't know what might need fixing.
Most errors are processed through routines in error.c in the code source.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]