2013-04-29 48 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')]