XML - Read a specific node
Hi, I need more help
I have a xml file that contains this node:
1.46590270801;
1.47197105847;
1.44441393964;
1.45198190444;
1.42069704633;
1.48390857689
And this code,
String xmlString = textBox4.Text;
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlString));
while (reader.Read())
{
XmlNodeType nodeType = reader.NodeType;
if (nodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "out":
textBox5.Text = reader.ReadString();
break;
}
}
}
If I ask to get a value from xml in a node like this:
testing
Using this code I can obtain in textbox5 the value testing.
But If I ask the value from node "out" the textbox5 is empty... and how can I get the first value (1.46590270801;)?
Cheers!
Venkatesh EllurPosted Oct 23, 2009, 8:38 AM
Once you get the node try reading the value of that node that will give the value desired instead of the name of the node. If this is not the solution you are looking for please explain the problem in a lil more detail so that i can help you out.