Here is my XML
,
<A>
<B id="ABC">
<C name="A" />
<C name="B" />
</B>
<X>
<B id="ZYZ">
<C name="A" />
<C name="B" />
</B>
</X>
</A>
I'm using following code to remove <X>
node without deleting its descents/childrens,
XDocument doc = XDocument.Load("D:\\parsedXml.xml");
doc.Descendants("A").Descendants("X").Remove();
But is removing entire <X>
block.
Expected output :
<A>
<B id="ABC">
<C name="A" />
<C name="B" />
</B>
<B id="ZYZ">
<C name="A" />
<C name="B" />
</B>
</A>