Sunday, November 25, 2012

Get number of element of specific name in a xml file

XmlDocument xdoc = new XmlDocument();
xdoc.Load(Server.MapPath("~/pp1.xml"));
string PersonCount = xdoc.DocumentElement.SelectNodes("//persons/person").Count.ToString();
Response.Write(PersonCount);

No comments:

Post a Comment