Removing ParentNode in a xml document
Hi All,
I have a XML document as below :
<First>
<Second>
<Third>
<Third_x>Some text</Third_x>
<Third_y>Some text</Third_y>
<Third_z>Some text</Third_z>
<ab>Some text</ab>
<xyz>
<xxx>10323</xxx>
<yyy>ID</yyy>
<zzz>nal</zzz>
<aaa>USA</aaa>
<bbb>Something for </bbb>
</xyz>
<xyz>
<xxx>10323</xxx>
<yyy>ugI</yyy>
<zzz>xtal</zzz>
<aaa>Canada</aaa>
<bbb>Something for </bbb>
</xyz>
</Third>
</Second>
</First>
I have to remove the entire ParentNode(<xyz>) if <aaa> has Canada text in it. The non matching <xyz> should still remain in the document.
I tried with node.getParentNode().removeChild(node);
But it didn't work.
Kindly help.
Thanks in advance.

