[jdom-interest] to change element text (keeping children)

Munirul Islam ba6450 at wayne.edu
Fri Nov 10 17:34:48 PST 2006


Hi!

I am trying to change the text of an element in a dom keeping its children.

n.setText("b");

Here, the setText method changes the text deleting n's children.

I tried the following code:

Element m = new Element("Element");
m = (Element) n.clone();
n.setText("b");
n.setContent(m.getChildren);

ends up giving illegalAddException.

Does anyone have a solution to this problem?

Thanks!
==============================
Munirul Islam
PhD Student
Department of Computer Science
Wayne State University
Detroit,MI-48202,USA
email: munirul at wayne.edu


More information about the jdom-interest mailing list