Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html XPath:提取除包含特定域名的URL以外的所有URL_Html_Xml_Xpath - Fatal编程技术网

Html XPath:提取除包含特定域名的URL以外的所有URL

Html XPath:提取除包含特定域名的URL以外的所有URL,html,xml,xpath,Html,Xml,Xpath,我试图从一个页面中只提取一组URL,但是我的输出包含一些我想忽略的不需要的URL 以下是用于提取所有URL的表达式: //div[contains(@id,'internal_trc_')]/div/a[2]/@href 我试过这个,但运气不好: //div[contains(@id,'internal_trc_')]/div/a[2]/@href[not(contains(text(), 'domain.com'))] 改变 到 因为属性没有文本节点子节点,但它们有字符串值 @href[n

我试图从一个页面中只提取一组URL,但是我的输出包含一些我想忽略的不需要的URL

以下是用于提取所有URL的表达式:

//div[contains(@id,'internal_trc_')]/div/a[2]/@href
我试过这个,但运气不好:

//div[contains(@id,'internal_trc_')]/div/a[2]/@href[not(contains(text(), 'domain.com'))]
改变

因为属性没有文本节点子节点,但它们有字符串值

@href[not(contains(text(), 'domain.com'))]
@href[not(contains(., 'domain.com'))]