I have a for each loop that I need help with. I am getting exception "Expression must evaluate to a node-set." when my if statement is executed.
What do I change in the if statement to fix this exception?
Note The objXMLNode can have either
CitationDocument or
JuvenileCitationDocument. In this particular case, there is only CitationDocument.
objXMLNode will never have both CitationDocument and JuvenileCitationDocument at the same time. So there will never be a list.
The xml I have posted here will always have those elements and nothing more.
objXMLNode object has the following xml
<CitationDocument xmlns="http://www.courts.state.us/CourtXML/3">
<Citation>
<Citee>
<InCustodyIndicator>true</InCustodyIndicator>
</Citee>
</Citation>
</CitationDocument>
What I have tried:
For Each objXMLNode In objXMLInputDoc.DocumentElement.SelectNodes("*[(local-name(.)='CitationDocument') or (local-name(.)='JuvenileCitationDocument')]")
If CBool(objXMLNode.SelectSingleNode("*[(local-name(.)='CitationDocument') or (local-name(.)='JuvenileCitationDocument')]/msc:Citation/msc:Citee/msc:InCustodyIndicator = True", objXMLNameSpaceManager).InnerText) Then
intPriority = 9
End If
Next