Re: [xml] Error handling with the XmlReader API
- From: Daniel Veillard <veillard redhat com>
- To: Stéphane Bidoul <stephane bidoul softwareag com>
- Cc: xml gnome org
- Subject: Re: [xml] Error handling with the XmlReader API
- Date: Mon, 20 Jan 2003 16:31:43 -0500
On Mon, Jan 20, 2003 at 09:21:57PM +0100, Stéphane Bidoul wrote:
Yep, I assume you tried to match the names of the accessors for the
Locators with those at the xmlTextReader level (can't
remember I switched
work to something else, the reader is a bit out of context ATM).
Right, here is the patch.
xmlreader.c:
- the opaque xmlTextReaderLocator is in
- I've mimicked parts of errors.c to skip some validation errors
that are not significant (because they contain only locator
info), and I've attempted to find the correct filename and
line number (maybe you should have a look at
xmlTextReaderLocatorLineNumber and xmlTextReaderLocatorBaseURI)
- the new exports are in libxml2.def.src
python bindings:
- new xmlTextReaderLocator wrapper class
- xmlTextReader error callbacks now accept (arg,msg,severity,locator)
- xmlParserCtxt error handling has been cleaned up and is now
closer to xmlTextReader error handling (single callback with severity);
there is a reserved argument to the callback for the locator
but it's not implemented yet (it needs a bit more thought)
- tests are adapted
drv_libxml2.py:
- new error handling with Locator, and an IsEmptyElement bug fix ;-(
Excellent ! Applied and commited :-)
I just got an exception in the last python test:
-----------------------------------
-- readererr.py
Traceback (most recent call last):
File "/u/veillard/XML/python/libxml2.py", line 516, in _xmlTextReaderErrorFunc return
f(arg,msg,severity,xmlTextReaderLocator(locator))
File "./readererr.py", line 18, in myErrorHandler
err = err + "%s (%d) %s:%d:%s" % (arg,severity,locator.BaseURI(),locator.LineNumber(),msg)
AttributeError: xmlTextReaderLocator instance has no attribute 'BaseURI'
Traceback (most recent call last):
File "/u/veillard/XML/python/libxml2.py", line 516, in _xmlTextReaderErrorFunc return
f(arg,msg,severity,xmlTextReaderLocator(locator))
File "./readererr.py", line 18, in myErrorHandler
err = err + "%s (%d) %s:%d:%s" % (arg,severity,locator.BaseURI(),locator.LineNumber(),msg)
AttributeError: xmlTextReaderLocator instance has no attribute 'BaseURI'
error
received
expected --> (3) test1:1:xmlns: URI foo is not absolute
--> (4) test1:1:Opening and ending tag mismatch: c and a
make[2]: [tests] Error 1 (ignored)
-----------------------------------
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]