//Time[@TOD=’Day’]//Task[@Status=’COMPLETED’]

huangapple go评论45阅读模式
英文:

Xpath where we can do value check for multiple values .//Time[@TOD='Day']//Task[@Status='COMPLETED']

问题

.//Time[@TOD='Day']//Task[@Status in 'COMPLETED', 'BLOCKED']
等于而不是等于的方式来检查status属性。

英文:

I have the below xpath that works on my XML easily when only one status needs to be checked:

.//Time[@TOD='Day']//Task[@Status='COMPLETED']

What is the way that I would be able to do something like so:

.//Time[@TOD='Day']//Task[@Status in 'COMPLETED', 'BLOCKED']
etc

Basically status attrib to have a in check rather than an equal to

答案1

得分: 2

在XPath 2或更高版本中,如果您的XPath处理器/API支持,可以使用例如.//Time[@TOD='Day']//Task[@Status = ('COMPLETED', 'BLOCKED')]。在XPath 1.0中使用or,例如.//Time[@TOD='Day']//Task[@Status = 'COMPLETED' or @Status = 'BLOCKED']

英文:

In XPath 2 or later, if your XPath processor/API supports it, you can use e.g. .//Time[@TOD='Day']//Task[@Status = ('COMPLETED', 'BLOCKED')]. In XPath 1.0 use or e.g. .//Time[@TOD='Day']//Task[@Status = 'COMPLETED' or @Status = 'BLOCKED'].

huangapple
  • 本文由 发表于 2023年7月13日 15:43:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76677019.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定