So where is the problem? Just find the elements you are interested in
(for example via XPath) and just do the same (<declarationsname>
is rootEl).<br>
<br>
Regards,<br>
G<br><br><div class="gmail_quote">2009/8/12 ♥..Vishu..♥ <span dir="ltr"><<a href="mailto:kashiviswanath.sagiri@gmail.com">kashiviswanath.sagiri@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi <span>Grzegorz Kaczor</span>,<br> Thank you very much for ur concern. But the point is my sample xml file is like this:<br><br><font style="font-family: verdana,sans-serif;" face="tahoma,sans-serif"><DOCUMENT><br>
<SECTION><br> <TOPOLOGY><br> <PRNPROC><br> <!-- THIS IS A COMMENT--><br> <declation><br> <declationsname> <br> <word>X</word><br>
</declationsname><br> </declation><br> <declation><br> <declationname><br> <word>Y</word><br>
</declationname><br> </declation></font><br><br>I would like to remove the <word> tag and replace the contents to <declationname> tag.<br>Thanking You<br><br>
Regards<br>
Kashi V Sagiri<div><div></div><div class="h5"><br style="font-family: verdana,sans-serif;"><div class="gmail_quote">On Wed, Aug 12, 2009 at 4:11 PM, Grzegorz Kaczor <span dir="ltr"><<a href="mailto:grzegorz.kaczor@gmail.com" target="_blank">grzegorz.kaczor@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<div><br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Hi,</div>
<div> 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</div></blockquote></div><br></div>For example like that:<br>
<br>String xmlString2 = "<input><int><a>aaa</a><b>bbb</b></int></input>";<br> <br>Document doc = new SAXBuilder().build(new StringReader(xmlString2));<br><br>
Element rootEl = doc.getRootElement();<br> <br>Element intEl = rootEl.getChild("int");<br>rootEl.removeContent(intEl);<br>rootEl.addContent(intEl.removeContent());<br> <br>new XMLOutputter().output(doc, System.out);<br>
<br>I get: <br><?xml version="1.0" encoding="UTF-8"?><br><input><a>aaa</a><b>bbb</b></input><br><br>Regards,<br><font color="#888888">Grzegorz</font><div><div>
</div><div><br clear="all"><br>-- <br>To be a man is, precisely, to be responsible.<br>
</div></div></blockquote></div><br><br clear="all"><br></div></div>-- <br><font color="#888888">$ VISHU $<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>To be a man is, precisely, to be responsible.<br>