Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.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
Xpath/HtmlAgilityPack:从href标记获取特定属性_Xpath_Tags_Html Parsing_Href_Html Agility Pack - Fatal编程技术网

Xpath/HtmlAgilityPack:从href标记获取特定属性

Xpath/HtmlAgilityPack:从href标记获取特定属性,xpath,tags,html-parsing,href,html-agility-pack,Xpath,Tags,Html Parsing,Href,Html Agility Pack,我正在使用HtmlAgilityPack解析html文件中的href标记。href标记如下所示: <h3 class="product-name"><a href="http://www.somewebsite.com/blahblah" title="Click Here to View This Product">Super Cool Product</a></h3> Super Cool Product - http://www.somew

我正在使用HtmlAgilityPack解析html文件中的href标记。href标记如下所示:

<h3 class="product-name"><a href="http://www.somewebsite.com/blahblah" title="Click Here to View This Product">Super Cool Product</a></h3>
Super Cool Product - http://www.somewebsite.com/blahblah
上面的代码给出的结果如下所示:

<h3 class="product-name"><a href="http://www.somewebsite.com/blahblah" title="Click Here to View This Product">Super Cool Product</a></h3>
Super Cool Product - http://www.somewebsite.com/blahblah
我试图找出如何分别提取名称和url,并将它们放入单独的字符串中,而不是将它们一起提取并放入一个字符串中。我猜我可以使用某种Xpath符号来实现这一点。如果有人能把我引向正确的方向,我将万分感激

谢谢,
Miles

你能举个例子说明你在找什么吗?从你描述的情况来看,你似乎已经有了。我正在尝试自己获取锚文本。现在,我的代码返回锚文本和url,并将其计算为一个字符串。哈哈,不管我怎么想,我都明白了。我从一个示例中获取了这一点,但忘记删除行“Text=lnks.InnerText”。对不起,浪费了大家的时间。