[jdom-interest] Getting schema validation working without enabling Xerces namespace support. How?

Travers Waker traversw at innoforge.co.za
Wed Sep 13 08:42:53 PDT 2000

> I'm not sure if I've quite got my head around this problem yet, so I
> may be misunderstanding just what the real issue is, but if I'm not,
> I think I can answer you.
> Schemas require namespaces. This isn't a Xerces decision or a JDOM
> decision. It's simply the way the schema spec is written. If you're
> going to validate against a schema, your well-formedness checks must
> include the checks required by the Namespaces in XML specification,
> not just those required by XML 1.0. You cannot turn off namespace
> processing and still validate against a schema.

OK, so schemas require namespaces.  This could either be in the form of
Xerces namespace support or JDOM's own namespace support.  One of these two
has to be enabled.

However, it is Xerces that is doing the validation with the schema, so
surely Xerces namespace support has to be enabled for schemas to work.  It
wouldn't help to enable namespace handling in JDOM because JDOM is not doing
the validation.

Fact:  The current build of JDOM does not validate against a schema when you
create a new SAXBuilder with validation set to true AND you stick the
relevant attributes pointing to the schema file onto the top of your .xml
document.  That info being:

<rootTag xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"

But, when you change the source code of SAXBuilder to enable Xerces
namespace handling, suddenly schema validation works fine.

Jason says that Xerces namespace support is disabled by JDOM because JDOM
does its own namespace support.  Does this mean that JDOM no longer supports
validation by Schemas, even though the underlying Xerces parser does?

Thanks for the responses so far.


More information about the jdom-interest mailing list