[jdom-interest] Schema validation & Java 1.5

Smith, Steven L. STEVEN.L.SMITH at saic.com
Mon Feb 6 05:47:59 PST 2006


I'm attempting to validate an XML document against a Schema using Xerces.
Using JDOM (1.0) under Java 1.4 this was accomplished as follows:

myBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser",true);
myBuilder.setFeature\("http://apache.org/xml/features/validation/schema",tru
e);
myParsedXmlDoc = myBuilder.build(xmlFile);

Since Java 1.4 uses Crimson as the default XML parser, I had to reference
the Xerces JAR files in the classpath. Our requirements now require us to
use Java 1.5 as the JVM - no problem, Java 1.5 includes Xerces as the
default XML parser. Unfortunately, I am getting a
"org.jdom.input.JDOMParseException" error when attempting to validate using
Java 1.5. I'm intentionally not including Xerces JAR files in the classpath
since 1.5 already includes Xerces.  What am I doing wrong? Can someone show
me how to do schema validation with Java 1.5?


More information about the jdom-interest mailing list