delete xml elements - using xpath search

T

Tharanga Abeyseela

Hi guys,


i need to delete the following pattern and its parent node from my xml
file (IF THE SEARCH STRING FOUND)

<Rating>NC</Rating>

if i find the above particular string , i need to delete the XML
elements (parent of the <Rating> element. problem is i have different
parent nodes with different names..

like

<movies>
<name> xxx</name>
<title>xxx </title>
<Rating>NC</Rating>
</movies>

<tvshow>
<name> </name>
<title>xxx </title>
<Rating>NC</Rating>
</tvshow>

<tvepisode>
<name>xxx </name>
<title>xxx </title>
<Rating>M</Rating>
</tvepisode>


as an example, i need to remove <movies> section and <tvshow> section
from my xml, (because it has the word NC) but need to keep <tvepisode>

can someone point me to the correct direction, or code snippet

Thanks in advance
tharanga
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top