Options
All
  • Public
  • Public/Protected
  • All
Menu

A wrapper over xmldom-ts. This class handles encoding while reading from files.

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

determineEncoding

  • determineEncoding(path: string): Promise<[string, Buffer]>
  • Tries to determine the proper encoding of the file, by the first processing instruction. Uses default encoding if none were found.

    Parameters

    • path: string

    Returns Promise<[string, Buffer]>

fromFile

fromString

  • fromString(xml: string, encoding?: undefined | string): XmlWrapper

loadFile

  • loadFile(path: string): Promise<DocumentImpl>
  • Loads the XML from given file.

    Parameters

    • path: string

    Returns Promise<DocumentImpl>

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

readFile

  • readFile(path: string): Promise<Buffer>
  • Read the given file. If a mock was provided, use the mock instead of fs.

    Parameters

    • path: string

    Returns Promise<Buffer>

toString

Generated using TypeDoc