Options
All
  • Public
  • Public/Protected
  • All
Menu

A wrapper over xmldom-ts. There are some convenient methods.

There are many gaps between the standard DOM feature set provided by browsers. I've tried to modify the original xmldom-ts package but failed. The original project doesn't provide a package-lock.json. tsc spills a whole lot of errors on it.

Hierarchy

Index

Constructors

constructor

Accessors

doc

  • get doc(): DocumentImpl

encoding

  • get encoding(): string

exception

hasError

  • get hasError(): boolean

root

  • get root(): ElementImpl | null

Methods

addNamespace

  • addNamespace(prefix: string, uri: string, node?: ElementImpl): XmlWrapper
  • Adds the given namespace declaration to the specified node, or root node if no node is given.

    Parameters

    • prefix: string
    • uri: string
    • Optional node: ElementImpl

    Returns XmlWrapper

fromString

  • fromString(xml: string, encoding?: undefined | string): XmlWrapper
  • Load XML from the given string. The encoding parameter must be correct.

    Parameters

    • xml: string
    • Optional encoding: undefined | string

    Returns XmlWrapper

lookupNamespaceURI

  • lookupNamespaceURI(prefix: string | null, node?: NodeImpl): string | null
  • Passes through to given node's lookupNamespaceURI(), and back track to ancestors if not found in the node.

    Parameters

    • prefix: string | null
    • Optional node: NodeImpl

    Returns string | null

lookupPrefix

  • lookupPrefix(uri: string | null, node?: NodeImpl): string | null
  • Passes through to given node's lookupPrefix(), and back track to ancestors if not found in the node.

    Parameters

    • uri: string | null
    • Optional node: NodeImpl

    Returns string | null

toString

  • Converts the XML document to string according to given options. Defaults to pretty print and keeps comment.

    Parameters

    Returns string

Generated using TypeDoc