[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: SAX Parser Raises Error Event Before startElement Event
  • From: "Bart Stok" <bart_stok@h...>
  • Date: Fri, 14 May 2004 08:45:11 +0000
  • Bcc:

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

_________________________________________________________________
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member