c#: get the attribute's xpath for an xml element



Given the following XML:



<enrollment>
<school>
<students>
<studentA fname="John" lname="Doe" age="23" />
<studentB fname="Mary" lname="Johnson" age="22" />
</students>
</school>
</enrollment>

foreach(XmlAttribute attr in node.Attributes)
{
//--get the XPath for each attribute
}


Where node = "studentA", how do I get the XPath for each attribute?


No comments:

Post a Comment