Convert Html string to node collection using HtmlAgilityPack

c# html-agility-pack vb.net xpath

Question

I have this html. I want to get list of node using html agility pack.

<span prop="name">Richard Winchester</span>
<span prop="company">Kodak</span>
<span prop="street">Arlington Road 1</span>

I tried this

Dim doc = New HtmlAgilityPack.HtmlDocument()
doc.LoadHtml(AboveHtmlInString)
Dim nodes = doc.DocumentNode.ChildNodes

But I am not getting collection of nodes.

Popular Answer

Your above code should work. I have made an identical representation in C# and it compiles and works as intended. It might be a visual basic issue.

HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(AboveHtmlString);
HtmlNodeCollection nodes = doc.DocumentNode.ChildNodes;


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why