<CustomersDataSet>
<Customers>
<ContactName>Yvonne Moncada</ContactName>
<City>Buenos Aires</City>
<Country>Argentina</Country>
<OrderId>10409</OrderId>
<OrderDate>1997-01-09T00:00:00.0000000-06:00</OrderDate>
<ProductId>14</ProductId>
</Customers>
<Customers>
<ContactName>Yvonne Moncada</ContactName>
<City>Buenos Aires</City>
<Country>Argentina</Country>
<OrderId>10409</OrderId>
<OrderDate>1997-01-09T00:00:00.0000000-06:00</OrderDate>
<ProductId>21</ProductId>
</Customers>
<Customers>
<ContactName>Sergio Gutirrez</ContactName>
<City>Buenos Aires</City>
<Country>Argentina</Country>
<OrderId>10448</OrderId>
<OrderDate>1997-02-17T00:00:00.0000000-06:00</OrderDate>
<ProductId>26</ProductId>
</Customers>
</CustomersDataSet>
//myDS is a Dataset.
string sXML = myDS.GetXml();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(sXML);
// if you have a raw XML file, just substitute next call with Load
//xmlDoc.Load(Server.MapPath("xmlDocument.xml"));
// just to retrieve the first child, you can omit next 2 lines..
XmlNode root = xmlDoc.FirstChild;
string s = root.FirstChild.OuterXml;
// just to retrieve the first child
// just for debug
s = xmlDoc.InnerXml.ToString();
// this is where it all happens
XmlNodeList myNodeList = xmlDoc.SelectNodes("/CustomersDataSet/Customers");
for (int on0Nodes = 0; on0Nodes < myNodeList.Count; on0Nodes++)
{
//Get each child of on1 nodes and tear it up.
XmlNodeList on1NodeList = myNodeList.Item(on0Nodes).ChildNodes ;
for (int on1Nodes = 0; on1Nodes < on1NodeList.Count; on1Nodes++)
{
//Show sample of Attribute
XmlNode att = on1NodeList.Item(on1Nodes);
//print the att value
if (att != null)
{
Console.WriteLine(att.InnerText);
}
}
Hope it helps someone!Quote:}
Mason.