[jdom-interest] Schema Validation

Christian Knorr christian.knorr at gmx.de
Wed Aug 8 00:35:36 PDT 2001

This is a topic of recent discussion. As a result two new methods have
been added to SAXBuilder to set special parser features and properties
(need to get that from the CVS). Xerces (which is the hardcoded standard
parser in JDOM) has the property: 


to set an external schema for validation purposes. For more information
about Xerces features and properties see: 


In addition you may want to ensure that the Xerces-parser is used. You
can accomplish that by explicitly setting the SAXDriverClass when
creating a SAXBuilder. 

IMPORTANT: The Xerces version that is distributed with JDOM does not
support these settings. You need to get the latest version of Xerces (I
am working with v1.42). 
Another trap is that JDOM references its own Xerces through the
manifest-file so you need to ensure that either the latest Xerces
version is loaded first or you simply replace the library that is
shipped with jdom. 

Last but not least: the two methods setFeature() and setProperty() are
stated to be the last resort as they might eventually interfere with
JDOM settings some day. See the discussion starting at: 


Christian Knorr

"Rodney S. Foley" wrote:
> I would like to know if we could use JDOM to validate an XML file
> against a 10/2000 Schema.  Also the XML file will not state a schema.
> We are doing this currently by using Oracle XML Parser v2.0.2 to
> validate an incoming XML file against a schema. Then we use JDOM B6 to
> read the file into our application.
> The reason we do it this way, is that we could not find out how to
> basically tell JDOM here is a schema and here is an XML file.  Then
> ask if the XML file is valid according to the provided schema.  We can
> do that with the Oracle XML Parser very easily, however we prefer to
> use JDOM for getting the XML into the application once it has passed
> validation.
> I am asking if JDOM can do this or something similar so we are not
> dependant on Oracle and JDOM, and we can only use JDOM.
> Please advise...
> Rodney S. Foley
> Software Developer
> Hard Dollar Corporation
> rsfoley at harddollar.com
> www.harddollar.com

More information about the jdom-interest mailing list