[jdom-interest] new content validated against DTD?

Jason Hunter jhunter at acm.org
Tue Sep 18 21:33:58 PDT 2001


This should probably be in the FAQ.

The answer is no, you can't have constant validation against a DTD, and
if you think about the implementation details you'll understand why. 
For example, take a simple document with one root element that has to
have exactly 3 children.  How do you build that document without ever
breaking the DTD while you're doing it?  You'd have to build it all in
one step.

There's a desire to have a validate() method that checks anytime you
want, which is the right approach, but no one's working on implementing
it yet.  Volunteers always wanted.

-jh-

James Holmes wrote:
> 
> I am using JDOM to parse Apache Jakarta Struts config
> files.  I read in the file using JDOM and then make
> changes to the file via JDOM.
> 
> My question is:  When adding new content (i.e.
> elements, attributes, etc) to a JDOM document, are the
> additions validated against the DTD that was used when
> the document was intially parsed?
> 
> My problem is that I am adding new elements to a JDOM
> document and they are not being added in the right
> order according to the DTD.
> 
> I'm guessing this not supported.  If not, are there
> any solutions/workarounds to achieve this
> functionality?
> 
> Thanks,
> 
> -james
> 
> __________________________________________________
> Terrorist Attacks on U.S. - How can you help?
> Donate cash, emergency relief information
> http://dailynews.yahoo.com/fc/US/Emergency_Information/
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list