Click here to Skip to main content
15,891,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

XML
<CitationDocument xmlns="http://www.courts.state.us/CourtXML/3">
	<Citation>
		<Citee>
			<InCustodyIndicator>true</InCustodyIndicator>
		</Citee>
	</Citation>
</CitationDocument>


What I have tried:

VB
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
Posted
Updated 9-Aug-18 10:11am
v3

1 solution

I no longer need help with this one
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900