OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   SAX Parser Raises Error Event Before startElement Event

[ Lists Home | Date Index | Thread Index ]

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 : 
- 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.


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS