Html XPath:提取除包含特定域名的URL以外的所有URL
我试图从一个页面中只提取一组URL,但是我的输出包含一些我想忽略的不需要的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
//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'))]