> Hello all,
>
> I am trying to get Xerces XML schema support working. Unfortunately, I'm
> running
> into a few problems.
>
> Whenever I try to turn on schema support, I get a
SAXNotRecognizedException
> thrown. Does anyone know what I'm doing wrong?
>
> Tech details:
> Using Xerces 1.4.0 (and later tried 1.3.1)
> Windows 2000
> JDK 1.3 (Also tried JDK 1.1.x)
>
> Code snippet:
> DOMParser parser = new DOMParser();
> parser.setFeature( "http://apache.org/xml/features/validation/schema",
> true );
> parser.parse( fName );
>
I don't know, where the problem is, I'll just send you my piece of code (for
SAXParser):
// this one creates a SAXParser
valparser = ParserFactory.makeParser
("org.apache.xerces.parsers.SAXParser");
// my dummy Error handler (just printing out errs/msgs) and DocumentHandler
(doing nothing)
DummParserHandler dummy = new DummParserHandler();
valparser.setDocumentHandler (dummy);
valparser.setErrorHandler (dummy);
// setting validation on
((org.apache.xerces.parsers.SAXParser) valparser).setFeature
("http://xml.org/sax/features/validation", true);
((org.apache.xerces.parsers.SAXParser) valparser).setFeature
("http://apache.org/xml/features/validation/schema", true);
// parsing
valparser.parse (new InputSource (new FileReader ("d:\\test.xml")));
This is a bit old code (for xml4j package), but it still works (with some
depreceated warnings...)
Hope it help a bit.
Roman
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]