Click here to Skip to main content
15,883,783 members
Articles / Programming Languages / XML
Alternative
Tip/Trick

Delete an XML node using the node name

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
24 Aug 2011CPOL 13.7K   1
Can't you do the same thing without the need for a select statement?XElement xElement = XElement.Load(path);xElement.Elements ("Node").Remove();xElement.Save(path);

Can't you do the same thing without the need for a select statement?


C#
XElement xElement = XElement.Load(path);
xElement.Elements ("Node").Remove();
xElement.Save(path);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
Wales Wales
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralYour code will remove all the "Node" elements, while Kim's c... Pin
KenBonny7-Sep-11 22:08
KenBonny7-Sep-11 22:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.