Thursday, 2 May 2013

How To count number of elements stored in XML by TagName ..



//Create an XDocument Object 
XmlDocument xmlD = new XmlDocument();
xmlD.Load("give you XML Path Here");

//Ceate an object of node list which get nodes by tag name
XmlNodeList xmlNL = xmlD.GetElementsByTagName("tagname");

// You will get count of nodes available in selected XML 
int Count = xmlNL.Count;

No comments:

Post a Comment