Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Schema validation & Java 1.5

Smith, Steven L.

2006-02-06


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?
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.