Hi Mukul, Mukul Gandhi <gandhi.mu...@gmail.com> wrote on 02/22/2009 08:51:37 AM:
> The class SAXParseException has a method, getSystemId() which can tell > whether the fault occurred in the Schema or the XML document. Might be useful to identify errors in the schema, however Uwe's question was about distinguishing schema validation errors from other types of errors which could be reported while processing the instance document. Also, even for schema errors, getSystemId() isn't particularly reliable. How can you tell from the URI what type of resource it's actually pointing to? It may not even have a value (e.g. schema document returned as an InputStream). > On Sun, Feb 22, 2009 at 2:08 PM, <q3s38w...@sneakemail.com> wrote: > > Hi there, > > > > I'm using Xerces2-J to parse an XML document into a DOM. My application is > > XML Schema aware, and the XML documents that my app is parsing are defined > > via a schema. > > When my application reads the XML document, it installs an ErrorHandler to > > catch parsing errors. However, I noticed that schema validation errors are > > caught by the very same interface (ErrorHandler.error(SAXParseException) and > > friends), so I can't determine if the error was a validation error or a > > parse error. The only possiblity I see to programmatically distinguish > > between the two is to parse the error message string, which hardly seems > > like a good solution to me. > > Is there another interface that I can use that allows me to do some more > > specific error handling? You can get more information through XNI. The XMLErrorHandler [1] interface exposes a message key and domain which uniquely identifies each error. > > Cheers, > > > > Uwe > > -- > Regards, > Mukul Gandhi > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/xni/org/apache/xerces/xni/parser/XMLErrorHandler.html Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org