SimpleXML(xPath)中的多个[not(contains(id,...))]

时间:2013-01-21 16:04:30

标签: xpath simplexml

我需要从XML列表中排除多个ID,我想知道如何让脚本工作。

我有类似的东西

  

//Réponses[not(contains(Constituent_x0020_ID,“34282,35224,34094”))] 不工作

     

//Réponses[not(contains(Constituent_x0020_ID,“34282”))] 工作

那么,如果我们想要过滤多个ID,那么使用的正确语法是什么,以便我的第一个例子有效?

更新

  

//Réponses[not(contains(Constituent_x0020_ID,“34282”))] [not(contains(Constituent_x0020_ID,“35224”))] [not(contains(Constituent_x0020_ID,“34094”))]

似乎工作但是......太长了。任何较小的解决方案?

1 个答案:

答案 0 :(得分:1)

我不认为这里有一个很好的解决方案,但这会略微缩短:

//Réponses[not(Constituent_x0020_ID[contains(., "34282") or contains(., "35224") or contains(., "34094")])]