How can I get values from Html Tags?

前端 未结 2 946
南方客
南方客 2021-01-29 03:42

I want to get some data from html tags in a web page. For example I have a web site that\'s got \"www.example.com/test.html\", this is text which I want to split. I want to firs

2条回答
  •  没有蜡笔的小新
    2021-01-29 04:15

    you need to have a look at:

    • Html Agility Pack

    here is the sample from codePlex.com

     HtmlDocument doc = new HtmlDocument();
     doc.Load("file.htm");
     foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"])
     {
        HtmlAttribute att = link["href"];
        att.Value = FixLink(att);
     }
     doc.Save("file.htm");
    

    Hope this helps

提交回复
热议问题