Remove the child node from selected parent but not grand children



anyone please help me to remove inner xml tag where i want to delete fn-group and fn id tag but i want its child p , p and emphasis tag should be retained


here is my sample xml file



<table-wrap-foot>
<fn-group type="footnotes">
<fn id="c89520-1-12">
<p>
<emphasis type="italic">Note</emphasis>:
In 1300, of the twenty-two cities in Italy that had populations over 20,000.
</p>
</fn>
</fn-group>
</table-wrap-foot>
</table-wrap>


here is my C# code



XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load("sample.xml");
XmlNodeList xmlnode = myXmlDocument.GetElementsByTagName("table-wrap-foot");

for (int i = 0; i < xmlnode.Count; i++)
{
if(xmlnode[i].InnerXml.Contains("<label>"))
{
}
else
{
#here i want to delete //fn-group and fn but not p tag
}
}
myXmlDocument.Save("sample.xml");


where i want to delete fn-group and fn id tag but i want its child p , p and emphasis tag should be retained here is my sample xml file

Thanks Appu


No comments:

Post a Comment