Sam:
I wrote a class that implements ErrorHandler. Each
method just writes out details for warning, error, and
fatal error cases as the interface demands. I
instantiated an instance and passed it to my parser's
setErrorHandler() method.
Still the bad document that I gave it parsed and
validated.
I'm using the personal-schema.xml and personal.xsd
files that come in xerces data directory. I've
downloaded Xerces 1.3, so I'm up-to-date.
The bad document has the first <person> tag commented
out, like this:
<!-- <person id="Big.Boss" > -->
<person>
The schema says the id attribute is required, so I'd
figure that Xerces would complain.
I've got a few features turned on:
parser.setFeature("http://xml.org/sax/features/validation",
true);
parser.setFeature("http://apache.org/xml/features/validation/dynamic",
true);
parser.setFeature("http://apache.org/xml/features/validation/schema",
true);
parser.setErrorHandler(new SchemaErrorHandler());
Any other thoughts would be appreciated. Thanks for
your help. - MOD
--- Sam Pullara <[EMAIL PROTECTED]> wrote:
> Are you listening for the error events that are
> coming off the ErrorHandler?
> Validation errors are not fatal errors and will not
> automatically generate
> exceptions. You need to listen for the "error"
> event from the handler.
>
> Sam
>
> -----Original Message-----
> From: Michael Duffy [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 22, 2001 10:53 AM
> To: [EMAIL PROTECTED]
> Subject: Re: AW: Validation ?
>
>
>
> This example is lovely, but it doesn't use schemas.
> Have you got a successful example of that? By
> "successful", I mean an example that will succeed
> AND
> fail to validate.
>
> Every document I feed to Xerces with a schema is
> parsed and "validated" successfully, even those that
> I
> believe should fail. It tells me that I probably
> don't tell Xerces where the .xsd file is correctly.
>
> --- "Werner, Sven" <[EMAIL PROTECTED]> wrote:
> > Hi!
> > Look At: http://ecerami.com/xerces/
> > <http://ecerami.com/xerces/> Theres an
> > Example of an validating parser written with
> xerces!
> >
> >
> > -----Urspr|ngliche Nachricht-----
> > Von: Matt Minyard
> [mailto:[EMAIL PROTECTED]
> > Gesendet am: Donnerstag, 22. Februar 2001 17:29
> > An: [EMAIL PROTECTED]
> > Betreff: Validation ?
> >
> > Hi,
> >
> > I'm having a problem using the validating
> > feature. I'm using the
> > following code to create the parser and set
> > validiation to true (I thought),
> > but documents with invalid tags are not generating
> > exceptoins. Any ideas?
> >
> > dom = new DOMParser();
> > dom.setFeature("
> > http://xml.org/sax/features/validation
> > <http://xml.org/sax/features/validation> ", true);
> >
> > Thanks,
> >
> > Matt
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great
> prices!
> http://auctions.yahoo.com/
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices!
http://auctions.yahoo.com/