Tuesday, 18 February 2014

How to create HTML document object from Html string using html agility pack ,C# Dot Net

Creating HTML Document Object Using HtmlAgilityPack 


Description
: HTML Document object can be created from HTML string using HtmlAgilityPack as given below.

Parameters: HtmlString => is HTml String

  public static HtmlDocument CreateHtmlDocumentObject(string HtmlString)
        {
            HtmlDocument htmDoc = new HtmlDocument();
            htmDoc.LoadHtml(HtmlString);
            return htmDoc;
        }

Other overloads of HtmlDocument to create HTML document object are as given below.

1.    public void Load(Stream stream);
2.    public void Load(string path);
3.    public void Load(TextReader reader);
4.    public void Load(Stream stream, bool detectEncodingFromByteOrderMarks);
5.    public void Load(Stream stream, Encoding encoding);
6.    public void Load(string path, bool detectEncodingFromByteOrderMarks);
7.    public void Load(string path, Encoding encoding);
8.    public void Load(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks);
9.    public void Load(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks);
10. public void Load(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int buffersize);
11. public void Load(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int buffersize);



No comments:

Post a Comment