Skip to content

Load or parse a document

Ivony edited this page Nov 29, 2013 · 4 revisions

to load or parse an HTML document, must using both of Ivony.Html and Ivony.Html.Parser namespaces

like this:

using Ivony.Html;
using Ivony.Html.Parser;

then, create a parser in your method.

var parser = new JumonyParser();

and parse an HTML Text.

var document = parser.Parse( "<p>text1<a href='#'>this is a link</a>" );

if we want to load an HTML page from Internet, we can use LoadDocument method

var document = parser.LoadDocument( "http://www.microsoft.com" );

it also can load local file:

var document = parser.LoadDocument( @"C:\my.html" );

LoadDocument method will automatic check page encoding from HTTP header, if it works have a problem, we can to specify the encoding, like this:

var document = parser.LoadDocument( "http://www.microsoft.com/", Encoding.UTF8 );
Clone this wiki locally