[jdom-interest] SubDocuments

Jason Hunter jhunter at servlets.com
Fri May 24 17:40:11 PDT 2002


Over time JDOM has been getting more careful about ensuring document
well formedness.  One rule is that an element can have at most one
parent.  Otherwise you can allow loops in your tree for example.  If you
want to steal an elt from another document, just call detach() on the
elt to remove it from its old place.  If you need it duplicated, you'd
need to clone() it.

-jh-

andres wrote:
> 
> I have inherited a system that uses JDOM documents for the navigation.
>  I am trying to upgrade to b8 but the way we use the documents is an
> issue.  Is it possible in b8 to use an Element from an existing Document
> to create a new Document?  Anybody know why this worked in b6 and, I
> think, b7?  I would like to be using this library correctly but I also
> don't want to rewrite my entire navigation subsystem.  The error that
> occurs from when I do:
> 
> new Document(anElementFromAnotherDocument);
> 
> is of course that it already has an existing parent.
> 
> Basically, navigation is determined by an "activity" xml and each
> element directly under the root is a Tab in the GUI.  When a Tab is
> clicked the navigator takes the Tab Element and creates a new Document
> that becomes the navigation for the GUI.
> 
> _______________________________________________
> 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