[jdom-interest] detach() [eg]

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Apr 21 06:11:50 PDT 2001


I propose the following compromise:

1. If detach() is called on the root element, then an exception is thrown.

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)

This would also detach the old root element. Both the JavaDoc and 
exception message for detach() should make this behavior clear.

Advantages:

1. Documents are always well-formed
2. You can detach the root element
3. No mysterious placeholder elements
4. Nothing in in org.jdom depends on the proper behavior of things in 
org.jdom.output

-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list