I have just used htmlagilitypack to extract all link as htmlnode from an html document, but i need this returned from my function as htmlelement
Dim Tags As HtmlNodeCollection = docNode.SelectNodes(strXpath)
Dim ListResult As New List(Of HtmlElement)
For Each Tag As HtmlNode In Tags
ListResult.Add(Tag.Element)
Next
Return Nothing
How can i do this?
I suspect the only way to do it is to create
HtmlElement, and then copy attributes and inner HTML fromHtmlNode.Here is an extension method for this; it accepts a reference to a
System.Windows.Forms.HtmlDocumentinstance to create a newHtmlElement:And to use it you could like this:
But please note, I’m not too familar with VB.NET, I created code examples for C# first and then translated them to VB,NET.