[jdom-interest] Missing Element.setName()

Elliotte Rusty Harold elharo at metalab.unc.edu
Fri Aug 25 08:30:48 PDT 2000

At 4:23 PM +0200 8/25/00, Falk Fraikin wrote:
>I scanned the archives and found this question (Why is there no setName
>method for element?) twice: 10th of August and in late June. Twice it was
>answered by Jason saying it already was a long discussion and that Elliotte
>should summarize the reasons. Well, I didn't find the summary and I
>definitely could use this function.
>(We are processing XML files by inserting some elements and attributes.
>Afterwards the files are written to disk again. To be able to distinguish a
>processed file we change the name of the root element after processing.)

Quick summary: an element whose name is changed is no longer the same element.

You do not need to change the element name for your use case. What 
you need to do is create a new root Element of a different type, and 
add the content to it. This can be done very quickly and simply by 


| 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