2012-01-28 42 views

回答

3

使用!?

//BLOCKQUOTE[@class='postcontent restore '] 
     /A[@href = 'http://domain.com/download.php'] 

這將選擇XML文檔中的任何A元素,其href屬性爲'http://domain.com/download.php',並且是XML文檔中任何BLOCKQUOTE元素的子元素,其class屬性具有stri NG值'postcontent restore '

如果你想選擇的鏈接有任何 URL指向該域,使用:

//BLOCKQUOTE[@class='postcontent restore '] 
     /A[starts-with(@href, 'http://domain.com/download.php')] 

更新:在註釋中OP澄清:

我想排除...任何以該鏈接/網址開頭的東西

使用

//BLOCKQUOTE[@class='postcontent restore '] 
     /A[not(starts-with(@href, 'http://domain.com/download.php'))] 
+0

感謝您的答覆....我想排除...任何開始與鏈接/ URL .....我嘗試以下操作=,而只!爲特定的鏈接工作,我想用http://domain.com/download.php開始使用通配符排除,所以像http://domain.com/download.php?11 - http:// domain .com/download.php?2 5- http://domain.com/download.php?32從選擇中排除。 – user204245 2012-01-28 05:32:31

+0

@ user204245:查看我答案的更新(最後)。 – 2012-01-28 05:45:11

+0

謝謝你的工作。 – user204245 2012-04-26 01:03:14