The following code works to validate versus a schema in 2.7.1 but not in
2.6.2 (I can tell because, if I feed it an invalid document, 2.7.1
complains and 2.6.2 doesn't). I've searched the user list archives and
looked in JIRA to see if it was a known issue and have found nothing. So
I'm hoping someone can point out what I'm doing wrong. Unfortunately,
upgrading to 2.7.1 isn't an option.
public class DigesterPlusSchema {
static final String XSD_SOURCE =
"C:\\document.xsd";
static final String XML_SOURCE =
"C:\\document.xml";
static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE =
"http://java.sun.com/xml/jaxp/properties/schemaSource";
public static void main(String[] args) throws Exception {
XMLReader reader = null;
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(true);
reader = spf.newSAXParser().getXMLReader();
reader.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
reader.setProperty(JAXP_SCHEMA_SOURCE, XSD_SOURCE);
reader.parse(new InputSource(XML_SOURCE));
System.out.println("Done!");
}
}
Thanks!
Derek Richardson
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]