简体   繁体   English

XPATH AND 同一节点上的条件

[英]XPATH AND Condition on same Node

this is a pretty simple question but I couldn't really find the correct result googling my problem.这是一个非常简单的问题,但我无法真正找到正确的结果来搜索我的问题。

I have this part of an xml document我有 xml 文档的这一部分

<ProcessTypes>
     <ProcessType>
           <ID>DRUCK</ID>
     </ProcessType>
     <ProcessType>
           <ID>EBOX</ID>
     </ProcessType>
</ProcessTypes>

What would be the correct xpath expression to check if i have both ids "DRUCK" and "EBOX" in my xml file?什么是正确的 xpath 表达式来检查我的 xml 文件中是否同时具有 ID“DRUCK”和“EBOX”?

This XPath expression,这个 XPath 表达式,

//ID="DRUCK" and //ID="EBOX"

will evaluate to true iff the XML document has an ID element with string value of "DRUCK" and an ID element with string value of "EBOX" .如果 XML 文档具有字符串值为"DRUCK"ID元素和字符串值为"EBOX"ID元素,则将评估为真。


Related, but not what was asked:相关,但不是问什么:

This XPath expression,这个 XPath 表达式,

//ProcessType[ID="DRUCK" or ID="EBOX"]

will select all ProcessType elements with ID child elements with string values of either "DRUCK" or "EBOX" .将 select 所有ProcessType元素的ID子元素的字符串值为"DRUCK""EBOX"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM