Errors are reported using the org.xml.sax.ErrorHandler interface.  You need
to provide an implementation
of that handler and register it with the parser using the
setErrorHandler(ErrorHandler) method.  While this
may seem at first an odd mix between SAX and DOM, there is nothing in the
DOM spec about handling
errors while building a DOM with an XML processor, which of course can
encounter errors.  Since something
needed to be added in the DOM case to address this problem, and as SAX
already provided a reasonable
service, it made no sense for us to create something new.  Look at some of
the samples/sax/*.java samples,
i.e. DocumentTracer, for examples.

As an aside, it would probably be helpful (and reasonable) if some of the
DOM samples actually used an
ErrorHandler in this manner.  At first glance none of them appear to do so.
I'll see about adding a defect in
Bugzilla to mention this when I have some time later...

Regards,
Glenn




박휘석 <[EMAIL PROTECTED]> on 06/03/2001 09:26:08 PM

Please respond to [EMAIL PROTECTED]

To:   "Xerces DEV" <[EMAIL PROTECTED]>
cc:   "Xerces User" <[EMAIL PROTECTED]>
Subject:  About Validation...





Hello..
I am studying about Xerces1.3.1 to Handling XML  with DTD/Schema.
Yesterday, I found a little strange thing about validation  just this;

DOMParser parser = new  DOMParser();
parser.setFeature("http://xml.org/sax/features/validation",true);
parser.parse(filepath);
Document  doc = parser.getDocument();
Element root =  doc.getDocumentElement();

You know, if XML data structure is different with  DTD/Schema,
I expect to occur validation error.. but it passed without any  error.

How can I test of  validation?


Reply via email to