[jdom-interest] Validation using schemas, how?

Christophe D. Laprun chris.laprun at nist.gov
Sun Sep 10 10:28:18 PDT 2000

Travers Waker wrote:
> Hi Jdom mailing list subscribers.
> I'm struggling with validating with schemas using JDOM.  I'm  trying to get
> a simple-as-can be schema to validate a simple-as-can-be XML doc.  I've
> included what I think should work
> I'm expecting this minimal test program to throw an exception because the
> contents of <tag> is 1, and I thought I was constraining it to being an
> integer >= 2 in test.xsd.  It doesn't behave like I expected (no Exception
> is thrown).  Also, when I call "new SAXBuilder(true)" with my code like it
> is, I get a message saying I must define the <tag> element.  specifying a
> dtd sorts that out, but surely one doesn't have to use both a dtd and a
> schema for validation - a schema on its own should be acceptable too.
> BTW, the latest complete download of Jdom in the CVS repository does not
> seem to be complete.  The jdom-complete.zip I downloaded wouldn't build
> becasue it didn't have Ant and Xerces in the lib directory.
> I feel a bit bad about this post because it's more a newbie request for help
> than a contribution towards the coding of Jdom.  Maybe it's time for a
> jdom-help mailing list.
> Thanks to anyone who can help.

I also struggled with namespaces and I found that in SAXBuilder the fact
that the "namespaces" feature is hardwired to false prevents
correct handling of schemas. Setting the property to true seemed to
the problem. 

This is an issue that I brought to the list but no one answered.
Why is this property hardwired to false ? Why isn't there a way to
programmatically set the property ?



Christophe Laprun    [Ingenieur ISIMA, France / Guest researcher @NIST]
web: http://www.nist.gov/speech/staff/laprunch.htm
email: chris.laprun at nist.gov
phone: (301) 975 3191             fax: (301) 670 0939
The universe seems neither benign nor hostile, merely indifferent -

More information about the jdom-interest mailing list