4
我有以下XPATH选择。XPATH通过通配符排除某些网址
// BLOCKQUOTE [@类= 'postcontent恢复']/A
现在我想排除使用通配符某些链路。
其中attribute @href =“http://domain.com/download.php *”
我怎么这个
我有以下XPATH选择。XPATH通过通配符排除某些网址
// BLOCKQUOTE [@类= 'postcontent恢复']/A
现在我想排除使用通配符某些链路。
其中attribute @href =“http://domain.com/download.php *”
我怎么这个
使用!?
//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'))]
感谢您的答复....我想排除...任何开始与链接/ 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
@ user204245:查看我答案的更新(最后)。 – 2012-01-28 05:45:11
谢谢你的工作。 – user204245 2012-04-26 01:03:14