簡體   English   中英

HttpWebResponse->如何查找具有特定ID,類和標題的鏈接?

[英]HttpWebResponse -> How Find A Link With Specific id and class and title?

如何解析HTML以查找具有特定idclasstitle的錨點( <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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM