View Single Post
  #3 (permalink)  
Old August 9th, 2018, 10:49 AM
winkimjr2 winkimjr2 is offline
Friend of Wrox
Points: 465, Level: 7
Points: 465, Level: 7 Points: 465, Level: 7 Points: 465, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Martin Honnen View Post
The methods "SelectNodes" and "SelectSingleNode" only work with XPath expressions that select nodes, if you want to evaluate XPath expressions returning a primitive value like a string, a number or a boolean then in the .NET framework you can do that by first using https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx "CreateNavigator()" on your "XmlNode" (in general) or "XmlDocument" and XPathNavigator has methods like the "Evaluate" method https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx which then returns the XPath result cast to the closest .NET type (e.g.

Code:
Dim value as Boolan = CBool(objXMLNode.CreateNavigator().Evaluate("*[(local-name(.)='CitationDocument') or (local-name(.)='JuvenileCitationDocument')]/msc:Citation/msc:Citee/msc:InCustodyIndicator = 'true'", objXMLNameSpaceManager))
should do to give you a boolean in VB.NET (if the CBool cast is the right way, not really being a VB.NET developer I am not sure about that but the documentation certainly has examples I hope that help you to work it out).
I did try what you suggested. However value is showing False even though it should be true because the element InCustodyIndicator = 'true'
Reply With Quote