[jdom-interest] Schema validation with JAXP 1.2 and JDOM

Laurent Bihanic laurent.bihanic at atosorigin.com
Fri Feb 28 09:32:07 PST 2003


Some tips for everyone interested in schema validation...

While upgrading to Xerces 2.3.0, I tried to shift from Xerces' specific 
properties for schema validation to the properties defined by JAXP 1.2.

Well... it doesn't work because Xerces XMLReader implementation requires the 
"http://apache.org/xml/features/validation/schema" feature to be set to true 
to take into account the JAXP 1.2 properties.

When using JAXP (i.e. without JDOM), setting the JAXP 1.2 properties shall be 
done on the JAXP SAXParser object, not on the XMLReader. The Xerces 
implementation of SAXParser takes care of setting the 
"http://apache.org/xml/features/validation/schema" feature when the schema 
language property is being set.

Unfortunately, JDOM's SAXBuilder does not perform any operation on the 
SAXParser object and deals only with the XMLReader.

Qestion: Now that JAXP is standard, i.e. part of the JDK since 1.4 and 
delivered with nearly every parser, why not remove this reflection code from 
SAXBuilder and make plain Java calls to the JAXP API (the way the transform 
package already does) ?

Once this done, JAXP schema validation properties could be set through the 
SAXParser.

Opinions?

Laurent




More information about the jdom-interest mailing list