# HtmlDocumentEngine

Provider-neutral front door for inert HTML document and contextual-fragment parsing. Returned trees are owned by OfficeIMO and do not expose provider nodes.

Class 

`OfficeIMO.Html`

**Namespace**

`OfficeIMO.Html`

**Assembly**

`OfficeIMO.Html`

**Source revision**

`56dd0d38e0b5` with working tree changes

**Source**

[HtmlDocumentEngine.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html/Engine/HtmlDocumentEngine.cs#L15)

**Modifiers**

sealed

Provider-neutral front door for inert HTML document and contextual-fragment parsing. Returned trees are owned by OfficeIMO and do not expose provider nodes.

## Inheritance

- object
- HtmlDocumentEngine

## Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 1

- Property [HtmlDocumentEngine.Default](/api/html/officeimo-html-htmldocumentengine/#property-default)

Filter members 

Show inherited

## Constructors

`public HtmlDocumentEngine(IHtmlParserProvider parserProvider)` [#](#constructor-ctor-officeimo-html-dom-ihtmlparserprovider)

[HtmlDocumentEngine.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html/Engine/HtmlDocumentEngine.cs#L15)

Creates an engine over a caller-selected parser provider.

Parameters

**parserProvider OfficeIMO.Html.Dom.IHtmlParserProvider required**

## Methods

`public HtmlDocument ParseDocument(string source, HtmlParseOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-parsedocument-string-officeimo-html-dom-htmlparseoptions-threading-cancellationtoken)

[HtmlDocumentEngine.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html/Engine/HtmlDocumentEngine.cs#L27)

Parses a complete HTML document into an immutable owned snapshot.

Parameters

**source string required**

**options OfficeIMO.Html.Dom.HtmlParseOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`HtmlDocument`

`public HtmlDocumentFragment ParseFragment(string source, HtmlElement contextElement, HtmlParseOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-parsefragment-string-officeimo-html-dom-htmlelement-officeimo-html-dom-htmlparseoptions-threading-cancellationtoken)

[HtmlDocumentEngine.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html/Engine/HtmlDocumentEngine.cs#L44)

Parses source using an owned element and its ancestors as the HTML fragment context. The result belongs to an independent immutable document. Import it into a mutable target document with HtmlDocument.ImportNode before insertion.

Parameters

**source string required**

**contextElement OfficeIMO.Html.Dom.HtmlElement required**

**options OfficeIMO.Html.Dom.HtmlParseOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`HtmlDocumentFragment`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public static HtmlDocumentEngine Default { get; }` [#](#property-default)

[HtmlDocumentEngine.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html/Engine/HtmlDocumentEngine.cs#L11)

The default engine shipped by OfficeIMO.Html.

`public IHtmlParserProvider ParserProvider { get; }` [#](#property-parserprovider)

[HtmlDocumentEngine.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/56dd0d38e0b526611c1af001c026f8c72600880f/OfficeIMO.Html/Engine/HtmlDocumentEngine.cs#L20)

The selected inert parser provider.

<!-- PowerForge markdown artifact sha256:93767611F139959DB5D60D61E35E7C5A1AAF288D5FBC67A095F2181E6C1506AE -->
