英文:
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']
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论