Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

HtmlDocument

Namespace OfficeIMO.Html.Dom
Assembly OfficeIMO.Html.Core
Modifiers sealed

An owned HTML tree with explicit snapshot and mutation semantics. Mutable documents require a single owner.

Inheritance

Usage

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

Accepted by parameters

Constructors

public HtmlDocument(IHtmlDomServices services, String providerId, HtmlDocumentMode mode = Standards) #

Creates an empty mutable document for a parser or programmatic authoring.

Parameters

services OfficeIMO.Html.Dom.IHtmlDomServices requiredposition: 0
providerId System.String requiredposition: 1
mode OfficeIMO.Html.Dom.HtmlDocumentMode = Standards optionalposition: 2

Methods

public HtmlDocument Clone() #
Returns: HtmlDocument

Creates an independent mutable clone, preserving node IDs and source positions.

public HtmlNode CreateComment(String text) #
Returns: HtmlNode

Creates a comment in this mutable document.

Parameters

text System.String requiredposition: 0
public HtmlDocumentType CreateDocumentType(String name, String publicIdentifier = "", String systemIdentifier = "") #
Returns: HtmlDocumentType

Creates a document type with the supplied identifiers.

Parameters

name System.String requiredposition: 0
publicIdentifier System.String = "" optionalposition: 1
systemIdentifier System.String = "" optionalposition: 2
public HtmlElement CreateElement(String localName, String namespaceUri = "http://www.w3.org/1999/xhtml", String prefix = null) #
Returns: HtmlElement

Creates a detached element in this mutable document.

Parameters

localName System.String requiredposition: 0
namespaceUri System.String = "http://www.w3.org/1999/xhtml" optionalposition: 1
prefix System.String = null optionalposition: 2
public HtmlNode CreateFragment() #
Returns: HtmlNode

Creates a detached fragment in this mutable document.

public HtmlNode CreateTextNode(String text) #
Returns: HtmlNode

Creates decoded text in this mutable document.

Parameters

text System.String requiredposition: 0
public HtmlDocument Edit(Action<HtmlDocument> edit) #
Returns: HtmlDocument

Applies edits to an independent clone and freezes the returned snapshot.

Parameters

edit System.Action{OfficeIMO.Html.Dom.HtmlDocument} requiredposition: 0
public HtmlDocument Freeze() #
Returns: HtmlDocument

Freezes this instance. Every retained node handle becomes read-only.

public HtmlNode GetNode(Int32 nodeId) #
Returns: HtmlNode

Finds a node by its document-local identity, including detached nodes.

Parameters

nodeId System.Int32 requiredposition: 0
public HtmlNode GetOrCreateTemplateContent(HtmlElement template) #
Returns: HtmlNode

Creates or returns this template element's separate content fragment.

Parameters

template OfficeIMO.Html.Dom.HtmlElement requiredposition: 0
public Void SetSourceIndex(HtmlNode node, Nullable<Int32> sourceIndex) #
Returns: Void

Attaches an original UTF-16 source position while constructing a mutable tree.

Parameters

node OfficeIMO.Html.Dom.HtmlNode requiredposition: 0
sourceIndex System.Nullable{System.Int32} requiredposition: 1

Properties

public Guid SnapshotId { get; } #

Unique identity of this tree instance; clones have independent identities.

public Int64 Revision { get; set; } #

Mutation revision used to invalidate derived state.

public Boolean IsReadOnly { get; set; } #

Whether this tree rejects further mutation, including detached nodes.

public String ProviderId { get; } #

Parser identity attached when the tree was created.

public HtmlDocumentMode Mode { get; } #

Layout compatibility mode established by the parser.

public IHtmlDomServices Services { get; } #

Syntax services used for queries and serialization.

public HtmlElement DocumentElement { get; } #

Root element, if present.

public HtmlElement Body { get; } #

Direct HTML body or frameset child of the root.

public HtmlElement Head { get; } #

Direct HTML head child of the root.