2012-01-28 45 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