[jdom-interest] detach() [eg]

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Apr 23 08:37:04 PDT 2001


At 10:47 AM -0400 4/23/01, Per Kreipke wrote:


>Use 2:
>
>Separately, I would like to do exactly what was questioned: "It might be one
>way programmers try to change the dtd or schema of a document."
>
>Basically, I'd like to rename the root of the document because its context
>has now changed to a different DTD.
>
>For example,
>
><employee>
>   <name first="Elmo" last="Schmotz"/>
></employee>
>
>Would change to:
>
><member>
>   <name first="Elmo" last="Schmotz"/>
></member>
>
>Can I do this without the detach() syntax currently in discussion?
>

Yes, you can. I'm not sure if it's the current CVS but a decision was 
recently made (against my objections) to add setName() and 
setNamespace() methods to Element, so no detach would be necessary, 
just changing the name of the existing Element. If these methods 
haven't been added yet, they should be available soon.
-- 

+-----------------------+------------------------+-------------------+
| 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