Hi,
I have to validate a SAX-stream against a XML-Schema. My plan was to 
implement a custom ContentHandler which sends all SAX-events to the 
parser. Therefore I used an instance of 
org.apache.xerces.parsers.SAXParser, because this class implements alls 
SAX-events. 

So I created an SAXParser and set the following features and properties:

SAXParser parser = new SAXParser();
parser.setFeature("http://xml.org/sax/features/validation";, true);
parser.setFeature("http://apache.org/xml/features/validation/schema";, 
true);
parser.setFeature("http://xml.org/sax/features/namespace-prefixes",true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation";,
 
"schema.xsd");
parser.setErrorHandler(handler);

The ErrorHandler is a custom one that throws exceptions in every case. 

Then I implemented start-/endDocument and start-/endElement of my 
DocumentHandler. In this methods I called:
parser.startElement(...), parser.endElement(...)....

So far so good (I hope). Then I started testing and debugging. I know, 
that the parser-methods are called. But I have a Problem with the 
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation-property.
 
The argument doesn't seem to have any influence to the parser. I can 
put every argument a want and never get an exception. I can even put an 
Boolean-object there! 
I tried debugging, but I didn't have any success. 

Within a fex minutes I will put the source-code of my ContentHandler on:
http://www.coblenzer.de/ParsingContentHandler.java

I hope, you can give me some hints! Thank you very much.

Best regards 
  Volker 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to