2013-04-29 51 views
0

我想写一个XPath表达式,将内ItemInfo通配符XPath中谓语

<Catalog> 
    <List> 
     <Item> 
     <ItemInfo> 
      This describes the Item In which it is listed. 
     </ItemInfo> 
     </Item> 
     <Item> 
     <ItemInfo> 
      This is another item description. 
     </ItemInfo> 
     </Item> 
    </List> 
</Catalog> 

评价一个特定的字符串,我知道我有可能需要包含(),并使用谓词。内部的字符串会非常长,并且会找到我正在查找的特定子字符串。我不确定如何在文本中使用通配符。这是我的想法,它可能是什么样子。

> /Catalog/List//Item/ItemInfo[contains(.,*'another'*)] 

回答

2

没有通配符。只需指定文字子串:

/Catalog/List//Item/ItemInfo[contains(.,'another')]