You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Brad O'Hearne <ca...@megapathdsl.net> on 2001/03/07 19:25:50 UTC

FW: Idea for the ErrorHandler

 In the ErrorHandler class, it would be very handy to have some additional
information sent to the error, fatalError, and warning methods, such as a
reference to the element stack, the element name, and/or a byte offset in
the stream, if that is being maintained.  Take for instance the following
Exception I report from my ErrorHandler:

org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x19) was
found in the element content of the document.
 at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:969)
 at
org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocume
ntScanner.java:643)
 at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:1355)
 at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:380)
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)

It would be really nice to know what element caused this problem, and
further, which occurrence of that element caused the problem.  I actually am
maintaining my own element stack for handling purposes, and so it looks like
I will probably store a reference to this stack in my ErrorHandler class.
However, I would think this type of information would be wanted by everyone,
and hence, possibly a helpful change to the source.

BradO

Re: FW: Idea for the ErrorHandler

Posted by Andy Clark <an...@apache.org>.
Brad O'Hearne wrote:
> It would be really nice to know what element caused this problem, and
> further, which occurrence of that element caused the problem.  I

You would know if you printed out the location information
contained in the SAXParseException that is passed to the
ErrorHandler. Granted, it's only row and column but that's
enough to find the error.

We can't change the ErrorHandler interface -- it's defined
by SAX. And I wouldn't want to see implementation details
surface through this interface anyway.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org