Please, refer MSDN documentation:
XmlDocument Class (System.Xml) | Microsoft Docs[
^], especially
Find nodes[
^] and
Edit nodes
.
You might be interested in
Select Nodes Using XPath Navigation[
^]
[EDIT]
According to the OP requirements (posted in solution 3):
Quote:
I Want to keep the xml file like it is
1. The only think I need is to create class like read one, two, tree or all values elements
2. one class to update one, two, tree or all values elements
I'd recommend to change your xml structure to this one:
<MyItems>
<MyItem id = "first">first one</Item>
<MyItem id = "second">first one</Item>
<MyItem id = "third">first one</Item>
<MyItem id = "fourth">first one</Item>
<!--
</MyItems>
A class representing single item this may look like:
public class MyItem
{
public string id = "first";
public string text = "first_one";
}
Finally, you need a collection of
MyItem
.
For further details, please read my tip:
A Complete Sample of Custom Class Collection Serialization and Deserialization[
^]. True, it's written in Vb.net, but you have to handle it, because Vb.net is pretty similar to C#.