demausdauth
Well-known member
Hope this is in the correct forum.
I am having trouble with navigating a Soap response with the XPath Navigator. If anyone has ideas or a better way of doing it that would be great.
My main question is: Is it because this is a soap envelope that my Node Iterater will not fill.
I am trying to drill down directly to the exact nodes I need rather than having to loop through all the objects. I thought that my syntax was correct but I never get anything in the node iterator. And the node does exist and there is a value in. I have seen it while stepping through in debug mode.
I have tried multiple values for the XPath to no avail. In debug mode I can use the .MoveToFirstChild() and .MoveToNext() and even .MoveToChild() methods to navigate to the correct node, but I still can't get the node iterator to fill.
I am having trouble with navigating a Soap response with the XPath Navigator. If anyone has ideas or a better way of doing it that would be great.
My main question is: Is it because this is a soap envelope that my Node Iterater will not fill.
VB.NET:
System.IO.MemoryStream memStream = new System.IO.MemoryStream();
XmlDocument xDoc = FindingSmartSearch.TraceExtension.XmlResponse;
xDoc.Save(memStream);
memStream.Position = 0;
docNav = new XPathDocument(memStream);
// Create a navigator to query with XPath.
nav = docNav.CreateNavigator();
NodeIter = nav.Select("//DidYouMean");
I am trying to drill down directly to the exact nodes I need rather than having to loop through all the objects. I thought that my syntax was correct but I never get anything in the node iterator. And the node does exist and there is a value in. I have seen it while stepping through in debug mode.
VB.NET:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<getSearchResponse xmlns="namespaceuri">
<searchResponse>
<AppliedFilters>
<Filter sequence="1" keywordInterface="Standard" displayStyle="Top">
<FilterStyle>Keyword</FilterStyle>
<FilterDescription>Keyword</FilterDescription>
<FilterValue sequence="1" displayStyle="Top">
<Description>past nots</Description>
<Value>past nots</Value>
<DidYouMean>post notes</DidYouMean>
</FilterValue>
</Filter>
</AppliedFilters>
</searchResponse>
</getSearchResponse>
</soapenv:Body>
</soapenv:Envelope>
I have tried multiple values for the XPath to no avail. In debug mode I can use the .MoveToFirstChild() and .MoveToNext() and even .MoveToChild() methods to navigate to the correct node, but I still can't get the node iterator to fill.