You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Dean Roddey <dr...@portal.com> on 2001/04/30 20:16:20 UTC

RE: SAXParseException does not seem to offer very rich informatio n...

By the time the SAX exception is thrown out to you, all of the information
in the scanner has been reset, because we've come out of the parse() call.
So you can't get any of that infomration at that point. You have to get it
during a callback. So if you install an error handler, you can then make
calls on the scanner object to get some more information, but not the
current line of text or anything like that. The scanner doesn't keep track
of that kind of information. It very much lives in the now, i.e. the current
character or token. You can get the current entity and last external entity
information, plus the line number info you already had.

--------------
Dean Roddey
Software Geek Extraordinaire
Portal, Inc
droddey@portal.com



-----Original Message-----
From: Prior, Chris [mailto:chris.prior@cazenove.com]
Sent: Monday, April 30, 2001 3:54 AM
To: 'xerces-c-dev@xml.apache.org'
Subject: SAXParseException does not seem to offer very rich
information...


Hi all,

When an exception of this type is thrown the error information available
(getSystemId, getLineNumber, getColumnNumber, getMessage) does not contain a
dump of the line which caused the parsing error - only a description.

This is ok if parsing from the a file as I can get at the line number and
column number, but when parsing from memory (xml over TCP/IP in my case) I
cannot issolate the offending line and I do not want to dump the entire xml
to a log (it could be huge). Specifically I am finding this a problem if an
element contains an attribute which applies to > 1 elements. An example of
the type of message I have seen is:

Error at file XMLName, line 12, char 17   Message: Required attribute
'ReferenceType' was not provided

*******Does anyone know how to get at the element, parent element name and
actual xml that caused the parsing error?********

Thanks in advance,

Chris
	


___________________________________________________
Email Disclaimer

This communication is for the attention of the
named recipient only and should not be passed
on to any other person. Information relating to
any company or security, is for information
purposes only and should not be interpreted as
a solicitation or offer to buy or sell any security.
The information on which this communication is based
has been obtained from sources we believe to be reliable,
but we do not guarantee its accuracy or completeness.
All expressions of opinion are subject to change
without notice. All e-mail messages, and associated attachments,
are subject to interception and monitoring for lawful business purposes.
___________________________________________________

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

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