[jdom-interest] Newbie: Schema validation of a document being built via JDOM
Steven D. Keens
skeens at planetfred.com
Mon Mar 19 05:16:25 PST 2001
You know, I think this is a great idea. I find that
I do a bit of runtime validation when building my JDOM
trees. Particularly when the tree is built via a
collaboration of many objects. I'm a defensive programmer
so I probably do more validation than most people. With
your idea I would just wrap my tree building in a try/catch
statement and catch the JDOMInvalidException (whatever it's called).
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of John Methot
Sent: Friday, March 16, 2001 20:06
To: 'jdom-interest at jdom.org'
Subject: [jdom-interest] Newbie: Schema validation of a document being
built via JDOM
I've read back through the archives since November for all
validation-related topics. I see a lot of questions about validating
documents that are being read.
My interest is in using JDOM to create documents programmatically. But I
don't see anything in the javadoc or tutorials on JDOM that say I can
validate a document as I'm building it. I can specify a systemID (a DTD or,
preferably, a schema) when I create a Document object. But then it would
seem useful if when I called Element.addAttribute() or Element.addElement()
(for example) I would get an exception if I tried to add an attribute or
child element that violated the schema.
I'm pretty sure this isn't there now (please correct me if it is and I'm
The only approach I can see right now is to build the entire document and
then validate it by parsing the whole thing, but that wouldn't give me much
visibility into the structural errors as they occur.
Anybody else have the desire to validate a document as it is built? Am I
thinking about this all wrong?
To control your jdom-interest membership:
More information about the jdom-interest