简体   繁体   English

2个Xpath表达式之间的区别

[英]Difference between 2 Xpath expressions

What's the difference between these two Xpath expressions? 这两个Xpath表达式有什么区别?

$z!="actors"
and
not($z="actors")

Thanks a lot! 非常感谢!

This is spelled out in detail in the XPath specification : 这在XPath规范中有详细说明

NOTE : If $x is bound to a node-set, then $x="foo" does not mean the same as not($x!="foo") : the former is true if and only if some node in $x has the string-value foo ; 注意 :如果$x绑定到节点集,则$x="foo"含义与not($x!="foo") :仅当$x 某个节点存在时,前者为true具有字符串值foo the latter is true if and only if all nodes in $x have the string-value foo . 当且仅当$x中的所有节点都具有字符串值foo ,后者才成立。

Essentially, all the general comparison operators = , != , < , <= , > and >= are implicitly existentially quantified over their arguments - X op Y is true if there is any pair of values from X and Y that satisfies the condition. 本质上,所有常规比较运算符=!=<<=>>=都隐式地存在于其参数上-如果X和Y中存在满足条件的对值,则X op Y为true。

$z != "actors"

means there is a node in $z that has a value other than "actors" (and there may also be other nodes in $z that do have the value "actors", the test will still be true if any of them have a different value), whereas 意味着在一个节点$z具有比“演员”(有也可能在其他节点以外的值$z 确实具有价值“演员”,测试仍然是真实的,如果任何人有不同的值),而

not($z = "actors")

means it is not the case that there is a node in $z whose value is "actors". 意味着它是不是有一个节点的情况下$z其值 “演员”。

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

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