Hi, I think you have to set the value "file:/c:/myDirectory/myschema.xsd" to the property "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" to make the parser find the schema on your hard drive.
Hope it'll work. Henrard Jean-François FORMATECH NEW TECHNOLOGIES Avenue G. Poelslaan 8-10 BRUXELLES 1160 BRUSSEL Tel. +32 2 675 08 41 Fax. +32 2 675 08 43 email [EMAIL PROTECTED] Web Site : http://www.formatech.be ----- Original Message ----- From: "Volker Katz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 27, 2004 11:45 AM Subject: SAX-stream validation > 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-che cking",true); > parser.setProperty("http://apache.org/xml/properties/schema/external-noNames paceSchemaLocation", > "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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]