<a href="/buffet-lau--nuong-hon-200-mon-an-huong-vi-han-quoc-tai-seoul-garden-hien-dai-nhat-vn-170ecccd214b42f8/dat-mua" id="cmPurchaseLink" name="cmPurchaseLink"></a>
如何获得
"/buffet-lau--nuong-hon-200-mon-an-huong-vi-han-quoc-tai-seoul-garden-hien-dai-nhat-vn-170ecccd214b42f8/dat-mua" id="cmPurchaseLink" name="cmPurchaseLink"
使用xpath(C#)?
答案 0 :(得分:3)
假设您发布的XML标记位于XmlDocument,您可以写:
string href
= yourXmlDoc.SelectSingleNode("//a[@id='cmPurchaseLink']/@href").Value;
答案 1 :(得分:0)
使用HtmlAgilityPack,我会用这个:
string summary = doc.DocumentNode.SelectNodes("//a[@id='cmPurchaseLink']")[0].Attributes["href"].Value