Hi Don,

  I had a similar problem with one of my xml files and I found out that 0x04
is not a legal XML character which caused parsing problems.  Since this is a
parsing type error you need to work with the Xerces error handling
mechanics, namely the ErrorHandler interface.  It is a similar concept as
Xalan's ProblemListener only it is for the Xerces parser.    You can create
a custom ErrorHandler and give it to Xalan with the
XalanTransformer::setErrorHandler.

-Corey


> -----Original Message-----
> From: Don McClimans [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 21, 2003 12:46 PM
> To: [email protected]
> Subject: RE: Getting the line and column number of an error
> 
> 
> Dave,
> 
> I'm back with more questions about error handling...
> 
> I accidentally generated a source file with a 0x04 character 
> in the text of
> an element (UTF-8 encoding). Xalan (correctly) does not like 
> this. When I
> run the command line xalan.exe, I get the message:
>       Fatal Error at (file test.txt, line 15729, column 24): 
> Invalid character
>  Unicode: 0x4)
>       Invalid character (Unicode: 0x4)
> 
> In my application, my custom problemListener is never called, and
> XalanTransformer::getLastError() returns:
>       Invalid character (Unicode: 0x4)
> 
> So I'm back to wondering how to get the line number of the error.
> 
> I tried creating a std::ostringstream, and calling
> XalanTransformer::setWarningStream with it. Unfortunately, no 
> message is
> stored in the ostringstream. Browsing the xalan code, this 
> has me confused,
> as it looks like that's where the first message ("Fatal 
> error...") above is
> coming from in the xalan.exe example. Should this work?
> 
> I'm now running the 2002/10/21 interim release. Should I 
> upgrade to the
> latest nightly build to (presumably) get your fix to return 
> the line number
> in getLastError()? How stable is this? I need something that 
> I can release
> to others.
> 
> Or is there another way to get at that information?
> 
> Thanks for any help you can give me.
> 
> Don
> 

Reply via email to