C# Class CsQuery.HtmlParser.ElementFactory

Element factory to build a CsQuery DOM using HtmlParserSharp.
Datei anzeigen Open project: prepare/HTML-Renderer Class Usage Examples

Public Methods

Method Description
Create ( Stream html, Encoding streamEncoding, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : IDomDocument

Creates a new document from a Stream of HTML using the options passed.

ElementFactory ( IDomIndexProvider domIndexProvider ) : System

Creates a factory using the DomIndexProvider passed by parameter

Parse ( Stream inputStream, Encoding encoding ) : IDomDocument

Given a TextReader, create a new IDomDocument from the input.

Private Methods

Method Description
CheckForReEncode ( ) : void

If a new character set encoding was declared and it's too late to change, switch to the new one midstream.

ConfigureDefaultContextMap ( ) : void

Configure default context: creates a default context for arbitrary fragments so they are valid no matter what, so that true fragments can be created without concern for the context

ConfigureTreeBuilderForParsingMode ( ) : void
ElementFactory ( ) : System

Static constructor.

GetContext ( string tag ) : string

Gets a default context for a tag

GetContextFromStream ( TextReader reader, string &context ) : TextReader

Gets a context by inspecting the beginning of a stream. Will restore the stream to its unaltered state.

GetDocType ( DocType docType ) : DocType
GetNewParser ( ) : ElementFactory
GetNewParser ( HtmlParsingMode parsingMode, HtmlParsingOptions parsingOptions, DocType docType ) : ElementFactory
InitializeTreeBuilder ( ) : void
MergeOptions ( HtmlParsingOptions options ) : HtmlParsingOptions
Reset ( ) : void
SetDefaultContext ( string tags, string context ) : void
Tokenize ( ) : void
tokenizer_EncodingDeclared ( object sender, HtmlParserSharp.Common.EncodingDetectedEventArgs e ) : void

Event is called by the tokenizer when a content-encoding meta tag is found. We should just always return true.

Method Details

Create() public static method

Creates a new document from a Stream of HTML using the options passed.
public static Create ( Stream html, Encoding streamEncoding, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : IDomDocument
html Stream /// The HTML input. ///
streamEncoding System.Text.Encoding /// The character set encoding used by the stream. If null, the BOM will be inspected, and it /// will default to UTF8 if no encoding can be identified. ///
parsingMode HtmlParsingMode /// (optional) the parsing mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
return IDomDocument

ElementFactory() public method

Creates a factory using the DomIndexProvider passed by parameter
public ElementFactory ( IDomIndexProvider domIndexProvider ) : System
domIndexProvider IDomIndexProvider /// The DomIndexProvider that will be used when creating new DomDocument objects from this factory. ///
return System

Parse() public method

Given a TextReader, create a new IDomDocument from the input.
/// Thrown when an invalid data error condition occurs. /// /// Thrown when the requested operation is invalid. ///
public Parse ( Stream inputStream, Encoding encoding ) : IDomDocument
inputStream Stream /// The HTML input. ///
encoding System.Text.Encoding /// The encoding. ///
return IDomDocument