XML : Generate xml from existing xml without one node

I want to generate an xml from existing one but remove one node by Id: My xml is:

  <PartyList>    <Party Id="1" In="true" Out="true"/>    <Party Id="2" In="true" Out="false"/>    <Party Id="3" In="true" Out="true"/>  </PartyList>    

and tried to select the node by using the following but cant remove it:

  xmlNode = xmlDoc.SelectSingleNode("/PartyList/Party[@Id='3']"));    

how can I remove it? and is there a better way by using linq to xml?

No comments:

Post a Comment