libxml2-wasm
    Preparing search index...

    Class XmlDocument

    The XML document.

    Hierarchy (View Summary)

    Index

    Properties

    canonicalize: (handler: XmlOutputBufferHandler, options?: C14NOptions) => void

    Canonicalize the document and invoke the handler to process.

    Type Declaration

    canonicalizeToString: (options?: C14NOptions) => string

    Canonicalize the document to a string.

    Type Declaration

      • (options?: C14NOptions): string
      • Parameters

        • Optionaloptions: C14NOptions

          options to adjust the canonicalization behavior

        Returns string

        The canonicalized XML string

    warnings: ErrorDetail[] = []

    Non-fatal diagnostics (warning-level, level === 1) emitted by libxml2 while parsing this document. Empty for documents created via create or parsed without any warnings. Fatal diagnostics are thrown as XmlParseError.

    Accessors

    • get dtd(): XmlDtd | null

      Get the DTD of the document.

      Returns XmlDtd | null

      The DTD of the document, or null if the document has no DTD.

    • get encoding(): string | null

      The actual encoding of the document, or null if not specified.

      Returns string | null

    • get root(): XmlElement

      The root element of the document. If the document is newly created and hasn’t been set up with a root, an XmlError will be thrown.

      Returns XmlElement

    • set root(value: XmlElement): void

      Set the root element of the document.

      Parameters

      • value: XmlElement

        The new root. If the node is from another document, it and its subtree will be removed from the previous document.

      Returns void

    • get standalone(): number

      The standalone status of the document (indicator about external refs).

      1 if standalone="yes", 0 if standalone="no", -1 if there is no XML declaration, -2 if there is an XML declaration, but no standalone attribute was specified

      Returns number

    • get version(): string

      The version string of the XML declaration.

      Returns string

    Methods

    • Dispose the object.

      It releases the managed resource and unregisters it from FinalizationRegistry. This ensures that the release of the managed resource doesn't have to wait until the object is garbage collected.

      To avoid resource leaks, explicitly call the Dispose method or use the using declaration to declare the object.

      Returns void

    • Create the root element.

      Parameters

      • name: string

        The name of the root element.

      • Optionalnamespace: string

        The namespace of the root element.

      • Optionalprefix: string

        The prefix of the root node that represents the given namespace. If not provided, the given namespace will be the default.

      Returns XmlElement

    • Process the XInclude directives in the document synchronously.

      Returns number

      the number of XInclude nodes processed.

    • Save the XmlDocument to a string

      By default, it outputs utf-8 encoded bytes, while ascii is another allowed option for options.encoding, which converts non-ascii characters into numeric character references.

      Parameters

      • Optionaloptions: SaveOptions

        options to adjust the saving behavior

      Returns string