[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    Re: Sax2 and error handling
From:       Gareth Reakes <gareth () decisionsoft ! com>
Date:       2003-02-26 9:43:38
[Download RAW message or body]

Hi,
	I think this may be a touch tricky. These errors are created from
the scanners. The one you use will probably be internal/IGXMLScanner .
These call emitError in framework/XMLValidator. This is where the line
information is available. This in turn calls error in 
parsers/SAX2XMLReaderImpl. Here is where the the SAXParseExceptions are 
created. It seems to me that calling emitError in the scanner is a 
reasonable bet. This means that you will need access to the scanner in the 
startElement call. You could pass this into the method (this will require 
changing the entire follow through from the scanner to your handler). 
Alternatively you could add a method to SAX2XMLReaderImpl to get the 
scanner (fScanner). You could then cast your SAX2XMLReader to an impl, get 
the scanner and set it as a member of your handler class. Calling 
emitError with the error text should then just work :) I have not tried 
this so I have no idea how much I'm missing. Give us a shout if you need 
more help.

Gareth



On Tue, 25 Feb 2003, Sylvester wrote:

> Hi,
> 
> I'm implementing a Sax2 parser, and I'd like to generate an error message with 
> the ErrorHandler in a function of the ContentHandler, let's say 
> startElement(). Unfortunately, here rises a problem: the functions error(), 
> warning() and fatalError() all need a SaxParseException as parameter, but I 
> don't know how to throw it myself. I could overload error() with a string 
> parameter, but then I'd like to have a way to know the line and column 
> number, so I can give a more precise error. Can anybody help?
> 
> tnx in advance,
> Erwin
> http://win-www.ruca.ua.ac.be/u/s005101/esp
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic