[英]HttpWebResponse -> How Find A Link With Specific id and class and title?
如何解析HTML以查找具有特定id
或class
或title
的錨點( <a />
)元素?
最終,我想找到href
屬性的值。
這是一個例子
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(somehtmlstring);
string value = doc.DocumentNode.Descendants("a")
.First(n => n.Attributes["class"].Value == "someclass")
.Attributes["href"]
.Value;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.