Delete and Edit the xml file nodes
This is my input sample.xml
<users>
<user name='aaa' password='111' status='0' expireson='2012-12-31' createdon='2011-05-31'>
<user name='bbb' password='222' status='0' expireson='2012-12-31' createdon='2011-05-31'/>
<user name='ccc' password='333' status='0' expireson='2011-12-31' createdon='2011-05-31'/>
<user name='ddd' password='444' status='0' expireson='2011-12-31' createdon='2011-05-31'/>
</user>
I need to delele the user tag (name as 'aaa') also
I need to edit the expireson on the user tag(name as 'ddd')
I'm new to c# language. I dono how to do this.
My sample Code for delete:
XmlDocument doc = new XmlDocument();
doc.Load(sample.xml");
XmlElement elmRoot = doc.DocumentElement;
string xPath = "/users/user[@name='aaa']";
XmlNode findnode = elmRoot.SelectSingleNode(xPath);
elmRoot.RemoveAll();
doc.Save(sample.xml");
But not working.
For editing i don't have any idea.
Please any help me.