I have this xml file: http://www.studiovincent.net/list.xml
I need parser with c#, to get values. Im using this code:
XmlReader xmlReader = XmlReader.Create("http://www.studiovincent.net/list.xml");
while (xmlReader.Read())
{
if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "field"))
{
if (xmlReader.HasAttributes)
Console.WriteLine(xmlReader.GetAttribute("name") + ": " + xmlReader.GetAttribute("price"));
}
}
Console.ReadKey();
but I get in OUTPUT this result:
name:
username:
age:
hair:
name:
username:
age:
hair:
name:
username:
age:
hair:
How Can I get this result?
Vincent
Hill
31
black
John
Tedelon
27
brown
Michael
Lopez
20
red
Frank
Lopez
25
black
and this result?
Vincent
John
Michael
Frank
Thanks in advance!
The following code will give you, your first result:
The following code will give you, your second result