如何检查xml中是否存在元素使用xpath?
发布时间:2020-12-16 08:08:05 所属栏目:百科 来源:网络整理
导读:下面是我的元素层次结构。如何检查(使用xpath)AttachedXml元素存在于主消费者的CreditReport下 Consumers xmlns="http://xml.mycompany.com/XMLSchema" Consumer subjectIdentifier="Primary" DataSources Credit CreditReport AttachedXml![CDATA[ blah bla
下面是我的元素层次结构。如何检查(使用xpath)AttachedXml元素存在于主消费者的CreditReport下
<Consumers xmlns="http://xml.mycompany.com/XMLSchema"> <Consumer subjectIdentifier="Primary"> <DataSources> <Credit> <CreditReport> <AttachedXml><![CDATA[ blah blah]]>
使用
boolean() XPath function
如果主消费者的CreditReport中有AttachedXml,那么它将返回true()。 boolean(/mc:Consumers /mc:Consumer[@subjectIdentifier='Primary'] //mc:CreditReport/mc:AttachedXml) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |