SAX Parser Raises Error Event Before startElement Event

B

Bart

Hello all,

I'm trying to catch the element name when a SAXParseException (error)
occurs. It was my intention to get the element's name with the
startElement(..String localName....) and then if a SAXParseException
is thrown, I know the element's name.
However, I discovered that a SAXParseException for a particular
element is thrown before the startElement event!!!!! So, during the
exception I will not know which element has got a problem. Of course,
I can use the getMessage() method of the SAXParseException. But the
exceptionmessage is useless to me, because i have to show it to an end
user and the message is too long to show to an end-user.
I don't think this is good behaviour.

I have 3 questions:
- Is the sequence of events and exceptions defined anywhere? I already
searched the web for the answer to this question but I only found a
description of the sequence of events :
http://www.mds.rmit.edu.au/~msf/misc/SAXEvents.html
- Is there an other way to get the element's name when a
SAXParseException is thrown? I know of the properties
http://xml.org/sax/properties/dom-node
and http://xml.org/sax/properties/xml-string . But these properties
are not supported by Xerces.
- I validate the XML with an xsd. Is there any way to make custom
parse error messages?

I hope someone can help me with these questions, because I already
worked for 2 weeks on this problem. Please tell me if something is not
clear.

greetings,
Bart
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top