我有一个HTML字符串变量,它是:
<html>
<body style="margin: 0; background: #e0e0e0; text-align:center;">
<div style="padding: 0; text-align: left; width: 800px; margin: 0 auto; background: #e0e0e0; ">
<div style="text-align: center; border-bottom: 10px solid #000; background: #FEDC00; ">
</div>
<div style="border: 0; padding: 20px; width: 760px; background: #fff; font-family: Helvetica, Arial; font-size: 12px;">
</tr></table><hr /><div style="font-weight: bold; width: 45%; text-align: center; float: left; "> <a style="font-size: 17px;display: block; color: #fff; background: #009900; text-decoration: none; padding: 10px 20px;" href="dabb68d353e3a82315ec6419e4aaa854&url=booking|358137|b4e3bea97e18db09d7878a6010b5b57b">ACCEPT</a></div>
</div></div>
</body>
</html>
如何获取href内容?
答案 0 :(得分:1)
您可以使用HTMLAgilityPack
var docs = new HtmlAgilityPack.HtmlDocument();
docs.LoadHtml("YourHTML");
string HrefValue= docs.DocumentNode.SelectSingleNode("//a").Attributes["href"].Value;