0
我有这样的代码:获取一个HTML页面中的网址与HTML敏捷性包
foreach (HtmlNode node in hd.DocumentNode.SelectNodes("//div[@class='compTitle options-toggle']//a"))
{
string s=("node:" + node.GetAttributeValue("href", string.Empty));
}
我想要得到的URL在标签是这样的:
<div class="compTitle options-toggle">
<a class=" ac-algo fz-l ac-21th lh-24" href="http://www.bestbuy.com">
<b>Huawei</b> Products - Best Buy
</a>
</div>
我想“http://www.bestbuy.com”和“华为产品 - 百思买”
我该怎么办?我的代码是否正确?
'是我的代码正确' - 为什么你不能检查是否你的代码是正确的? –
它不返回我的网址 – mary
那么你应该知道问题的答案*“我的代码是否正确?”* –