I'm using a simple XmlReader on the following file structure:
<application>
<nodetitle permission="perm1">Some Dept</nodetitle>
<project>Project A</project>
<links>
<link>
<pagename>page1.aspx</pagename>
</link>
<link>
<pagename permission="perm2">page2.aspx</pagename>
</link>
<link>
<pagename>page3.aspx</pagename>
</link>
</links>
</application>
I'm rusty on the XML API and my problem is reading the sibling <link> elements in a single pass - my instinct is to look to create some kind of inner loop?
while (reader.Read())
{
...
if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "links"))
{
// read all <link> elements in a single pass
}
...
}
UPDATE - 06-25-2011
I'm going to try and be a little more specific. I'm not using XPath. Using either the XmlReader or Linq to Xml (am totally unfamiliar with this), I want a way to extract the link elements and attributes and check their values.