[jdom-interest] detach() [eg]
Jason Hunter
jhunter at collab.net
Sun Apr 22 10:53:29 PDT 2001
Elliotte Rusty Harold wrote:
>
> I propose the following compromise:
>
> 1. If detach() is called on the root element, then an exception is thrown.
Current mneumonic:
addContent(elt.clone()); // copy
addContent(elt.detach()); // move
Proposed mneumonic:
addContent(elt.clone()); // copy
try {
addContent(elt.detach()); // try a move
} catch (IllegalXXXException e) {
elt.getDocument().setRootElement(new Element("filler"));
addContent(elt);
}
I prefer the former.
> 2. We add a method to Document that detaches and replaces the root
> element with a different element; e.g.
>
> public void changeRootElement(Element newRoot)
That's what setRootElement() does currently.
-jh-
More information about the jdom-interest
mailing list