1

I am having trouble navigating to some nested XML nodes. I am using the XpathNavigator and can see the proper nodes have been captured, but I am not able to parse them properly. Any help would be appreciated:

<root>
  <audits>
<supervisorAuditId>311004</supervisorAuditId>
    <supervisorName>Munjkhkiz, John</supervisorName>
    <supervisorCenter>CA</supervisorCenter>
    <supervisorManager>HNubnot, Harry</supervisorManager>
    <followupDate>07/31/2014</followupDate>
    <graded>3</graded>
    <addedOn>07/23/2014</addedOn>
    <addedBy>HNubnot, Harry</addedBy>
    <responses>
      <mqField>BM1</mqField>
      <mqFieldTitle>Balanced Coaching</mqFieldTitle>
      <comments>another test</comments>
      <actions>another test 1</actions>
    </responses>
    <responses>
      <mqField>BM5</mqField>
      <mqFieldTitle>Productivity</mqFieldTitle>
      <comments>another test 4</comments>
      <actions>another test 5</actions>
    </responses>
    <responses>
      <mqField>BM3</mqField>
      <mqFieldTitle>Conduct</mqFieldTitle>
      <comments>another test 2</comments>
          <actions>another test 3</actions>
    </responses>
  </audits>
</root>

Code:

foreach (System.Xml.XPath.XPathNavigator item2 in iterator)
{
    System.Xml.XPath.XPathNavigator _element2 = item2.SelectSingleNode("audits/responses");

    _element2 = item2.SelectSingleNode("responses[@mqField='BM1']");
    comments1 = _element2.Value;

    _element2 = item2.SelectSingleNode("responses/actions");
    actions1 = _element2.Value;
}
kjhughes
  • 106,133
  • 27
  • 181
  • 240
CJSantora
  • 21
  • 4
  • possible duplicate of [XPath: How to select elements based on their value?](http://stackoverflow.com/questions/1198253/xpath-how-to-select-elements-based-on-their-value) – Steve Guidi Jul 24 '14 at 21:59

0 Answers0