XML : Parse XML with XDocument using C#

I have the following XML file:
  <?xml version="1.0" encoding="utf-8"?>  <html>      <body>          <p><p>             <span class="screenitems">                 Close                  <MCap:variable name="1052.zartzut"></MCap:variable>                  without prompting if you launch a non-                 <MCap:variable name="zirtZat"></MCap:variable>                 measurement module. (You will be prompted to save any unsaved data.)                 <span lol="scs">dsfsfs</span>              </span>          </p></p>      </body>  </html>    
I want to only delete <span class="screenitems"> and the corresponding end tag </span>, so it should after parsing look as follows:
  <?xml version="1.0" encoding="utf-8"?>  <html>      <body>          <p><p>                   Close                  <MCap:variable name="1052.zartzut"></MCap:variable>                  without prompting if you launch a non-                 <MCap:variable name="zirtZat"></MCap:variable>                 measurement module. (You will be prompted to save any unsaved data.)                 <span lol="scs">dsfsfs</span>            </p></p>      </body>  </html>    
<span class="screenitems"> is the only unique tag so in between this and <html>, you can have everything. Can you help me with this issue using XDocument methods in C# ?

No comments:

Post a Comment