下面是我的元素层次结构。如何检查(使用xpath)AttachedXml元素存在于主消费者的CreditReport下
<Consumers xmlns="http://xml.mycompany.com/XMLSchema"> <Consumer subjectIdentifier="Primary"> <DataSources> <Credit> <CreditReport> <AttachedXml><![CDATA[ blah blah]]>
使用
原文链接:https://www.f2er.com/xml/293628.htmlboolean()
XPath function
The boolean function converts its
argument to a boolean as follows:
a number is true if and only if
it is neither positive or negative
zero nor NaNa node-set is true if and only if
it is non-emptya string is true if and only if
its length is non-zeroan object of a type other than
the four basic types is converted to a
boolean in a way that is dependent on
that type
如果主消费者的CreditReport中有AttachedXml,那么它将返回true()。
boolean(/mc:Consumers /mc:Consumer[@subjectIdentifier='Primary'] //mc:CreditReport/mc:AttachedXml)