We are interested in finding maximum number of attributes a node has in a XML document. My code is below using C#:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"C:\ABC.xml");
XmlNode root = xmlDoc.DocumentElement;
int nodeAttrCount = 0;
foreach (XmlNode node in root)
if (nodeAttrCount < node.Attributes.Count)
nodeAttrCount = node.Attributes.Count;
We are interested is: do we have any thing better than this. Like any method or property which give us the same result or anyother option.