Table of Contents

Class HtmlReader

Namespace
DocWright.Formats.Html
Assembly
DocWright.Formats.Html.dll

Reads HTML into the mutable DocWright document model.

public sealed class HtmlReader : IDocumentReader
Inheritance
HtmlReader
Implements
Inherited Members

Remarks

The parser is tolerant by design rather than conforming: real-world HTML is malformed far more often than not, and a reader that refused it would be useless on the documents most likely to be converted. Unclosed tags, stray end tags, mis-nested formatting and tag soup all parse to something predictable. The recovery rules are documented in COMPAT.md, and what cannot be represented in a Word document is reported through IConversionDiagnostics rather than dropped in silence.

No network or file-system access happens on a document's behalf. A data: URI is decoded because its bytes are already in the document; every other reference needs an ResourceResolver the host supplies.

Instances are stateless and safe for concurrent use; one read allocates one parse.

Constructors

HtmlReader()

Initializes a reader with default options.

HtmlReader(HtmlReadOptions)

Initializes a reader with format-specific options.

Properties

Format

Gets the format this reader handles.

Methods

CanRead(Stream)

Sniffs whether a stream looks like HTML, restoring its position before returning.

Read(Stream, DocumentReadOptions, IConversionDiagnostics)

Reads a document from the stream.