>
>
> > I noticed an earlier question regarding turning on SAX2's validation
> > feature and here was the code included in the response:

This was a response based on SAX 2.0 _alpha_, not SAX 2.0 (beta/final).  See
comments below...
> >
> >
> > try

> >    Parser parser =
> > ParserFactory.makeParser("org.apache.xerces.parsers.SAXParser");

This is no longer part of SAX 2, but SAX 1.  To do this with SAX 2:

XMLReader parser =
  new org.apache.xerces.parsers.SAXParser();

The org.sax.XMLReader interface replaces org.sax.Parser (which is now
deprecated).

> >
> >
((Configurable)parser).setFeature("http://xml.org/sax/features/validation";
> > , true);

The Configurable interface from SAX 2.0 alpha is now integrated into the SAX
2.0 XMLReader interface.  So you simply need to do:

  parser.setFeature("http://xml.org/sax/features/validation";, true);

> >    // you need to supply an error handler in order to see an error
> > message!
> >    parser.setErrorHandler(h);
> >    parser.parse(args[0]);
> > } catch (Exception e)

> >    e.printStackTrace();
> > }

The rest is OK.

> >
> >
> > I've seen this reference to the "Configurable" interface before and I
> > thought it was located at org.xml.sax.Configurable, but much to my
dismay
> > I can't find this sucker anywhere.  I just want to test the Xerces
schema
> > validation stuff and since my compiler doesn't recognize Configurable
I'm
> > stuck for the time being.

Not any more ;-)  For more on SAX2 , check out www.megginson.com/SAX/SAX2
for the API docs.  Also, by the way, you are turning on *validation* in this
example, not (just) schema validation.  Two separate things... you also turn
on DTD validation as well.

> >
> > Any help would be greatly appreciated, obviously I'm a newbie so the
more
> > explicit the help the better.

let me know if you need more help...

-Brett

> >
> > Thanks,
> > Matt
> >
> >
>

Reply via email to