Options
All
  • Public
  • Public/Protected
  • All
Menu

TagSoup - v1.0.0

Index

Type aliases

ContainerNode

ContainerNode: IDocumentNode | IElementNode

DataNode

The data node of the DOM tree.

Node

A node of the DOM tree.

Token

A token provided to SAX handler callback.

Variables

Const domHandler

domHandler: IDomHandler<Node, ContainerNode> = ...

The default DOM handler.

Const htmlParserOptions

htmlParserOptions: IParserOptions = ...

The default HTML parser options:

  • CDATA sections and processing instructions are treated as comments;
  • Self-closing tags are treated as a start tags;
  • Tags like p, li, td and others follow implicit end rules, so <p>foo<p>bar is parsed as <p>foo</p><p>bar</p>;
  • Tag and attribute names are converted to lower case;
  • Legacy HTML entities are decoded in text and attribute values. To decode all known HTML entities use:
import {decodeHtml} from 'speedy-entities/lib/full';

createHtmlSaxParser({
  decodeText: decodeHtml,
  decodeAttribute: decodeHtml,
});
see

decodeHtml

Const xmlParserOptions

xmlParserOptions: IParserOptions = ...

The default XML parser options:

  • CDATA sections, processing instructions and self-closing tags are recognized;
  • XML entities are decoded in text and attribute values;
  • Tag and attribute names are preserved as is;
see

decodeXml

Functions

createDomParser

  • Creates a new stateful DOM parser.

    Type parameters

    • Node

      The type of object that describes a node in the DOM tree.

    • ContainerNode

      The type of object that describes an element or a document in the DOM tree.

    Parameters

    • handler: IDomHandler<Node, ContainerNode>

      The handler that provides factories and callbacks that produce the DOM tree.

    • Optional options: IParserOptions

      The parser options.

    Returns IParser<Node[]>

    The new parser that produces a DOM tree during parsing.

createHtmlDomParser

createHtmlSaxParser

createSaxParser

createXmlDomParser

createXmlSaxParser

Generated using TypeDoc