Tuesday, September 4, 2012

Reading XML file


http://forum.codecall.net/topic/58239-c-tutorial-reading-and-writing-xml-files/
http://csharptutorial.blogspot.com/2006/10/reading-xml-fast.html
using System;
using System.Collections.Generic;
using System.Xml;
namespace TempCSharp
{
class Program
{
static void Main(string[] args)
{
XmlDocument doc = new XmlDocument();
doc.Load("test.xml");
XmlNodeList customers = doc.SelectNodes("//customer");
foreach (XmlNode customer in customers)
{
Console.WriteLine("Age = {0}, Gender = {1}",
customer.Attributes["age"].Value, customer.Attributes["gender"].Value);
}
}
}
}

No comments:

Post a Comment