Convert Html string to node collection using HtmlAgilityPack

c# html-agility-pack vb.net xpath

Question

This HTML is mine. Using the HTML Agility Pack, I want to retrieve a list of nodes.

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

I did it.

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

But I'm not seeing any node collections.

1
1
10/28/2015 10:42:24 AM

Popular Answer

Your code should run successfully. In C#, I created a representation that is exactly the same, and it compiles and functions as intended. It could be a problem with visual basic.

HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(AboveHtmlString);
HtmlNodeCollection nodes = doc.DocumentNode.ChildNodes;
1
11/9/2015 11:35:16 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow