View Single Post
  #2 (permalink)  
Old August 9th, 2018, 10:37 AM
Martin Honnen Martin Honnen is offline
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

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).
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog

Last edited by Martin Honnen; August 9th, 2018 at 10:41 AM..
Reply With Quote