0
<Content Client="PQRS" ContentSectionName="INTRO">
    <Files>
        <p>abcd efgh.</p>
        <p>abcdefgh<b>ijk</b>lmnopq.</p>
        <File>
            <FileName>yyyy</FileName>
            <FilePath>xxxxxx</FilePath>
        </File>
            <File>
            <FileName>zzzz</FileName>
            <FilePath>xxxxxxyyyyy</FilePath>
        </File>
    </Files>
</Content>

Above Content is an Xelement.Value and want to remove every paragraph "p" node in the XElement.

JleruOHeP
  • 10,106
  • 3
  • 45
  • 71
Chat
  • 185
  • 1
  • 5
  • 15

1 Answers1

1

You can, for example, get all the p nodes in that element and just Remove() them:

var pNodes = element.Descendants("p").ToList();
foreach(var n in pNodes)
{
    n.Remove();         
}
JleruOHeP
  • 10,106
  • 3
  • 45
  • 71