[jdom-interest] Reordering elements for DTD compliance

philip.nelson at omniresources.com philip.nelson at omniresources.com
Mon Sep 17 17:02:36 PDT 2001


> There are two solutions to the above problem-
> 1) Only add the children to an element in an order that you know is 
> compatable with the DTD

The correct answer ;-)

> 2) Sort the elements on output
> 

Also a correct answer ;-).  Only in this case, you get to write your own
outputter or an intermediary step before outputting.  JDOM's job is to very
carefully output what you told it to output.  Your job is to tell JDOM what
to output.


> As I don't want changes to the DTD to affect the code, the 
> second is the 
> better choice. I've started writing code that will read in 
> the DTD and sort 
> the elements into order before calling XMLOutputter.
> 
> Is it non-deterministic? Maybe, but it seems like a very real 
> word example 
> to me. And it is far more convenient to treat the JDOM tree 
> as a useful data 
> structure rather than an absolute version of the XML you want 
> to produce.
> 
> Stephen Colebourne
> 
> 
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at 
http://explorer.msn.com/intl.asp

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list