[jdom-interest] Schema validation.

Damien Dudouit damien at ssl.co.uk
Wed Jan 16 03:35:49 PST 2002


I have been using JDom for a while and also received quite a few emails on
the mailing list with that title. But please don't hit the delete button
staightaway :).
So, today for the first time I tried validation on an XML schema. The
validation fails on the root element saying it must be defined. I'm using
JDom with Xerces and I went on Xerces web site to see how Xerces supports
XML Schema validation.
It appears it works by setting features on the XMLReader:
DTD validation:
reader.setFeature("http://xml.org/sax/features/validation", true)
XML Schema validation:
reader.setFeature("http://xml.org/sax/features/validation/schema", true)

I went on the code of JDom SAXBuilder and only the first feature for DTD
support is set. Since the org.jdom.SAXBuilder class only expose the method
setValidation(boolean) and not setFeature(..) on the underlying XMLReader,
what's the tip??

Thanks a lot,


More information about the jdom-interest mailing list