Names>
name>
firstname>John
lastname>Smith
/Name>
name>
firstname>James
lastname>White
/Name>
/Names>
//C#
XmlDocument xml = new XmlDocument();
xml.Load(myXmlString); // suppose that myXmlString contains "
XmlNodeList xnList = xml.SelectNodes("/Names/Name");
foreach (XmlNode xn in xnList)
{
string firstName = xn["FirstName"].InnerText;
string lastName = xn["LastName"].InnerText;
Console.WriteLine("Name: {0} {1}", firstName, lastName);
}
No comments:
Post a Comment