Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading from string instead of document/url

I just found out about html agility pack and I tried it, but stumbled upon a problem. I couldn't find anything on the web so I am trying here.

Do you know how I can load the HTML from a string instead of document/URL?

Thanks.

like image 945
Darko Avatar asked Feb 27 '12 01:02

Darko


2 Answers

Have you tried using LoadHtml?

string htmlString = 'Your html string here...';

HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
htmlDocument.LoadHtml(htmlString);

// Do whatever with htmlDocument here
like image 75
ohaal Avatar answered Nov 16 '22 20:11

ohaal


i think there's a function to do that right?

HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml("<test>");
like image 38
melaos Avatar answered Nov 16 '22 21:11

melaos