Reputation:
How to use HtmlAgilityPack to Replace all hyperlinks, e.g.:
<a href="url">Link</>
so that only the href attribute is left. the url.
Is this possible?
Upvotes: 3
Views: 2281
Reputation:
Dim Doc as HtmlDocument = new HtmlDocument
doc.LoadHtml(MyHtml)
Dim links As HtmlNodeCollection = doc.DocumentNode.SelectNodes("//a")
For Each link In links
Dim att As HtmlAttribute = link.Attributes("href")
MyHtml = Myhtml.Replace(link.OuterHtml, att.Value)
Next
Upvotes: 6