如何修复异常表达式必须求值为节点集? [英] How do I fix exception expression must evaluate to a node-set?

查看:96
本文介绍了如何修复异常表达式必须求值为节点集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我需要帮助的每个循环。我得到了异常表达式必须评估为节点集。当我的if语句被执行时。

我在if语句中如何更改以修复此异常?



注意 objXMLNode可以有 CitationDocument JuvenileCitationDocument 。在这种特殊情况下,只有CitationDocument。

objXMLNode将永远不会同时拥有CitationDocument和JuvenileCitationDocument。所以永远不会有一个清单。

我在这里发布的xml将始终具有这些元素,仅​​此而已。



objXMLNode对象有以下xml



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

推荐答案

I不再需要这个帮助


这篇关于如何修复异常表达式必须求值为节点集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆