Re: Deleting node name:

Grzegorz Kaczor <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
Hello,

Hi,
>       Could you just brief me how will you do it? and also i have to remove
> all the <int> tags from the document. Please reply as early as possible.
> Thanking you
>

For example like that:

String xmlString2 = "<input><int><a>aaa</a><b>bbb</b></int></input>";

Document doc = new SAXBuilder().build(new StringReader(xmlString2));

Element rootEl = doc.getRootElement();

Element intEl = rootEl.getChild("int");
rootEl.removeContent(intEl);
rootEl.addContent(intEl.removeContent());

new XMLOutputter().output(doc, System.out);

I get:
<?xml version="1.0" encoding="UTF-8"?>
<input><a>aaa</a><b>bbb</b></input>

Regards,
Grzegorz

-- 
To be a man is, precisely, to be responsible.

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.