[jdom-interest] no method: Element.setName(String). Why?

Travers Waker traversw at innoforge.co.za
Tue Sep 19 01:58:54 PDT 2000


Hi all.

I've found a need for the following method of the Element class (but it
doesn't exist):

 Element.setName(String name)

Is there a technical reason why this method can't exist in the current Jdom?

At the moment I'm getting around this limitations as follows:
use Element.getCopy(String name) to create a clone (deep copy) of the
element.  This is pretty wasteful, because I don't need the original element
tree any more and would liek to reuse it with a new root element name
instread of doing expensive deep copies.

In case you're interested in where I'm applying this: It's to represent
request and response message pairs.  In most cases, the XML request message
is exactly the same as the response message except for:
1. The root element is called {something}ResponseMessage instead of
{something}RequestMessage.
2. The addition of a  ResponseCode child element.
3. The addition of a ResponseMessage child element.

2 and 3 are easy to do with Jdom, but changing the name of the root element
is not.

Thanks for any help or info.

Travers





More information about the jdom-interest mailing list