Several customers want to validate with XML Schema but still use general entities for shorthand. I'm not having much luck finding the magic combination of Xerces features that makes this work. E.g.,

SAXParser parser = new SAXParser(symbolTable, grammarPool);
parser.setEntityResolver(er);
parser.setErrorHandler(eh);
try {
parser.setFeature("http://xml.org/sax/features/namespaces";, true);
parser.setFeature("http://xml.org/sax/features/validation";, true);
parser.setFeature("http://apache.org/xml/features/validation/schema";, true);


parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking";, true);
InputSource in = new InputSource(docReader);
in.setSystemId(docUri);
parser.parse(in);
...


With the above, validation is always done from the DTD, ignoring the schema explicitly declared in the document with xsi:schemaLocation. If I change "http://xml.org/sax/features/validation"; to false, no validation is done at all.

Help greatly appreciated!

Bob Foster


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



Reply via email to