First, your XML nodes can't start with number like what you have. Take a look at the
XML Elements[
^] at W3 Schools and look at the
XML Naming Rules. You will need to do something like this:
="1.0"="utf-8"
<Start>
<Node>
<Value>1</Value>
<Text>Hi World</Text>
</Node>
<Node>
<Value>2</Value>
<Text>Hi World</Text>
</Node>
</Start>
Second, RyanDev was pointing you to use the
XDocument
for you to research and learn so that when someone puts code like this:
var documentRoot = XDocument.Load(@"C:\MyXmlFile.xml").Root;
var textNode = (from nodes in documentRoot.Elements("Node")
where nodes.Element("Value").Value == "1"
select nodes.Element("Text")).FirstOrDefault();
Console.WriteLine(textNode.Value);
You would be able to understand it. The
XDocument
in .NET is very easy to use and understand. I recommend that you take some time to learn it. For small XML documents, it is all I use. Below are a few tutorials that should get you started.
How to Start with XML and LINQ: A Beginner Guide.[
^]
Understanding C#: Simple Linq to XML Queries[
^]