xmlbuilder

  • Version 15.1.1
  • Published
  • 321 kB
  • No dependencies
  • MIT license

Install

npm i xmlbuilder
yarn add xmlbuilder
pnpm add xmlbuilder

Overview

An XML builder for node.js

Index

Functions

Classes

Interfaces

Enums

Type Aliases

Functions

function begin

begin: {
(options?: BeginOptions): XMLDocument;
(
options?: BeginOptions | OnDataCallback,
onData?: OnDataCallback | OnEndCallback,
onEnd?: OnEndCallback
): XMLDocumentCB;
};
  • Creates a new XML document and returns the document node. This function creates an empty document without the XML prolog or a root element.

    Parameter options

    create options

  • Creates a new XML document in callback mode and returns the document node.

    Parameter options

    create options

    Parameter onData

    the function to be called when a new chunk of XML is output. The string containing the XML chunk is passed to onData as its first argument and the current depth of the tree is passed as its second argument.

    Parameter onEnd

    the function to be called when the XML document is completed with end. onEnd does not receive any arguments.

function create

create: (
nameOrObject: string | { [name: string]: Object },
xmldecOrOptions?: CreateOptions,
doctypeOrOptions?: CreateOptions,
options?: CreateOptions
) => XMLElement;
  • Creates a new XML document and returns the root element node.

    Parameter nameOrObject

    name of the root element or a JS object to be converted to an XML tree

    Parameter xmldecOrOptions

    XML declaration or create options

    Parameter doctypeOrOptions

    Doctype declaration or create options

    Parameter options

    create options

function streamWriter

streamWriter: (stream: Writable, options?: WriterOptions) => XMLWriter;
  • Creates and returns a default stream writer.

    Parameter stream

    a writeable stream

    Parameter options

    writer options

function stringWriter

stringWriter: (options?: WriterOptions) => XMLWriter;
  • Creates and returns a default string writer.

    Parameter options

    writer options

Classes

class XMLAttribute

class XMLAttribute {}
  • Represents an XML attribute.

property name

name: string;
  • Attribute name

property parent

parent: XMLElement;
  • Parent element node

property type

type: NodeType;
  • Type of the node

property value

value: string;
  • Attribute value

method clone

clone: () => XMLAttribute;
  • Creates a clone of this node

method toString

toString: (options?: XMLToStringOptions) => string;
  • Converts the node to string

    Parameter options

    conversion options

class XMLCData

class XMLCData extends XMLCharacterData {}
  • Represents a CDATA node.

method clone

clone: () => XMLCData;
  • Creates a clone of this node

method toString

toString: (options?: XMLToStringOptions) => string;
  • Converts the node to string

    Parameter options

    conversion options

class XMLCharacterData

abstract class XMLCharacterData extends XMLNode {}
  • Represents the base class of character data nodes.

property value

value: string;
  • Node value

class XMLComment

class XMLComment extends XMLCharacterData {}
  • Represents a comment node.

method clone

clone: () => XMLComment;
  • Creates a clone of this node

method toString

toString: (options?: XMLToStringOptions) => string;
  • Converts the node to string

    Parameter options

    conversion options

class XMLDeclaration

class XMLDeclaration {}
  • Represents the XML declaration.

property encoding

encoding: string;
  • Encoding declaration, e.g. UTF-8

property standalone

standalone: boolean;
  • Standalone document declaration: true or false

property version

version: string;
  • A version number string, e.g. 1.0

method toString

toString: (options?: XMLToStringOptions) => string;
  • Converts the node to string.

    Parameter options

    conversion options

class XMLDocType

class XMLDocType {}
  • Represents the document type definition.

property children

children: XMLNode[];
  • Child nodes

property parent

parent: XMLElement;
  • Parent element node

property pubID

pubID: string;
  • Public identifier of the DTD

property sysID

sysID: string;
  • System identifier of the DTD

property type

type: NodeType;
  • Type of the node

method att

att: (
elementName: string,
attributeName: string,
attributeType: string,
defaultValueType: string,
defaultValue?: any
) => XMLDocType;

    method attList

    attList: (
    elementName: string,
    attributeName: string,
    attributeType: string,
    defaultValueType: string,
    defaultValue?: any
    ) => XMLDocType;
    • Creates an attribute declaration.

      _Alias:_ att

      Parameter elementName

      the name of the element containing this attribute

      Parameter attributeName

      attribute name

      Parameter attributeType

      type of the attribute

      Parameter defaultValueType

      default value type (either #REQUIRED, #IMPLIED, #FIXED or #DEFAULT)

      Parameter defaultValue

      default value of the attribute (only used for #FIXED or #DEFAULT)

      Returns

      the DOCTYPE node

    method cdata

    cdata: (value: string) => XMLDocType;
    • Creates a new CDATA node and appends it to the list of child nodes.

      _Alias:_ dat

      Parameter value

      node value

      Returns

      the DOCTYPE node

    method clone

    clone: () => XMLDocType;
    • Creates a clone of this node.

    method com

    com: (value: string) => XMLDocType;

      method comment

      comment: (value: string) => XMLDocType;
      • Creates a new comment child and appends it to the list of child nodes.

        _Alias:_ com

        Parameter value

        node value

        Returns

        the DOCTYPE node

      method dat

      dat: (value: string) => XMLDocType;

        method doc

        doc: () => XMLDocument;

          method document

          document: () => XMLDocument;
          • Returns the document node.

            _Alias:_ doc

          method ele

          ele: (name: string, value?: Object) => XMLDocType;

            method element

            element: (name: string, value?: Object) => XMLDocType;
            • Creates an element type declaration.

              _Alias:_ ele

              Parameter name

              element name

              Parameter value

              element content (defaults to #PCDATA)

              Returns

              the DOCTYPE node

            method end

            end: (options?: XMLWriter | XMLToStringOptions) => string;
            • Converts the XML document to string.

              Parameter options

              conversion options

            method ent

            ent: (
            name: string,
            value: string | { pubID?: string; sysID?: string; nData?: string }
            ) => XMLDocType;

              method entity

              entity: (
              name: string,
              value: string | { pubID?: string; sysID?: string; nData?: string }
              ) => XMLDocType;
              • Creates a general entity declaration.

                _Alias:_ ent

                Parameter name

                the name of the entity

                Parameter value

                entity parameters

                Returns

                the DOCTYPE node

              method ins

              ins: {
              (target: string, value: any): XMLDocType;
              (array: any[]): XMLDocType;
              (obj: Object): XMLDocType;
              };

                method instruction

                instruction: {
                (target: string, value: any): XMLDocType;
                (array: any[]): XMLDocType;
                (obj: Object): XMLDocType;
                };
                • Creates a new processing instruction node and appends it to the list of child nodes.

                  _Alias:_ ins

                  Parameter target

                  node target

                  Parameter value

                  node value

                  Returns

                  the DOCTYPE node

                method not

                not: (name: string, value: { pubID?: string; sysID?: string }) => XMLDocType;

                  method notation

                  notation: (
                  name: string,
                  value: { pubID?: string; sysID?: string }
                  ) => XMLDocType;
                  • Creates a notation declaration.

                    _Alias:_ not

                    Parameter name

                    the name of the entity

                    Parameter value

                    entity parameters

                    Returns

                    the DOCTYPE node

                  method pent

                  pent: (
                  name: string,
                  value: string | { pubID?: string; sysID?: string }
                  ) => XMLDocType;

                    method pEntity

                    pEntity: (
                    name: string,
                    value: string | { pubID?: string; sysID?: string }
                    ) => XMLDocType;
                    • Creates a parameter entity declaration.

                      _Alias:_ pent

                      Parameter name

                      the name of the entity

                      Parameter value

                      entity parameters

                      Returns

                      the DOCTYPE node

                    method root

                    root: () => XMLElement;
                    • Returns the root element node.

                      _Alias:_ up

                    method toString

                    toString: (options?: XMLToStringOptions) => string;
                    • Converts the node to string.

                      Parameter options

                      conversion options

                    method up

                    up: () => XMLElement;

                      class XMLDocument

                      class XMLDocument extends XMLNode {}
                      • Represents the XML document.

                      method toString

                      toString: (options?: XMLToStringOptions) => string;
                      • Converts the node to string

                        Parameter options

                        conversion options

                      class XMLDocumentCB

                      class XMLDocumentCB {}
                      • Represents an XML document builder used in callback mode with the begin function.

                      method a

                      a: {
                      (name: any, value?: any): XMLDocumentCB;
                      (
                      elementName: string,
                      attributeName: string,
                      attributeType: string,
                      defaultValueType?: string,
                      defaultValue?: any
                      ): XMLDocumentCB;
                      };

                        method att

                        att: {
                        (name: any, value?: any): XMLDocumentCB;
                        (
                        elementName: string,
                        attributeName: string,
                        attributeType: string,
                        defaultValueType?: string,
                        defaultValue?: any
                        ): XMLDocumentCB;
                        };

                          method attList

                          attList: (
                          elementName: string,
                          attributeName: string,
                          attributeType: string,
                          defaultValueType?: string,
                          defaultValue?: any
                          ) => XMLDocumentCB;
                          • Creates an attribute declaration.

                            _Alias:_ att

                            Parameter elementName

                            the name of the element containing this attribute

                            Parameter attributeName

                            attribute name

                            Parameter attributeType

                            type of the attribute (defaults to CDATA)

                            Parameter defaultValueType

                            default value type (either #REQUIRED, #IMPLIED, #FIXED or #DEFAULT) (defaults to #IMPLIED)

                            Parameter defaultValue

                            default value of the attribute (only used for #FIXED or #DEFAULT)

                            Returns

                            the document builder object

                          method attribute

                          attribute: (name: any, value?: any) => XMLDocumentCB;
                          • Adds or modifies an attribute.

                            _Aliases:_ att and a

                            Parameter name

                            attribute name

                            Parameter value

                            attribute value

                            Returns

                            the document builder object

                          method c

                          c: (value: string) => XMLDocumentCB;

                            method cdata

                            cdata: (value: string) => XMLDocumentCB;
                            • Creates a new CDATA node and appends it to the list of child nodes.

                              _Aliases:_ dat and d

                              Parameter value

                              node value

                              Returns

                              the document builder object

                            method com

                            com: (value: string) => XMLDocumentCB;

                              method comment

                              comment: (value: string) => XMLDocumentCB;
                              • Creates a new comment node and appends it to the list of child nodes.

                                _Aliases:_ com and c

                                Parameter value

                                node value

                                Returns

                                the document builder object

                              method d

                              d: (value: string) => XMLDocumentCB;

                                method dat

                                dat: (value: string) => XMLDocumentCB;

                                  method dec

                                  dec: (
                                  version?: string,
                                  encoding?: string,
                                  standalone?: boolean
                                  ) => XMLDocumentCB;

                                    method declaration

                                    declaration: (
                                    version?: string,
                                    encoding?: string,
                                    standalone?: boolean
                                    ) => XMLDocumentCB;
                                    • Creates the XML declaration.

                                      _Alias:_ dec

                                      Parameter version

                                      version number string, e.g. 1.0

                                      Parameter encoding

                                      encoding declaration, e.g. UTF-8

                                      Parameter standalone

                                      standalone document declaration: true or false

                                      Returns

                                      the document builder object

                                    method doctype

                                    doctype: (root: string, pubID?: string, sysID?: string) => XMLDocumentCB;
                                    • Creates the document type definition.

                                      _Alias:_ dtd

                                      Parameter root

                                      the name of the root node

                                      Parameter pubID

                                      public identifier of the DTD

                                      Parameter sysID

                                      system identifier of the DTD

                                      Returns

                                      the document builder object

                                    method dtd

                                    dtd: (root: string, pubID?: string, sysID?: string) => XMLDocumentCB;

                                      method dtdElement

                                      dtdElement: (name: string, value?: Object) => XMLDocumentCB;
                                      • Creates an element type declaration.

                                        _Aliases:_ element and ele

                                        Parameter name

                                        element name

                                        Parameter value

                                        element content (defaults to #PCDATA)

                                        Returns

                                        the document builder object

                                      method e

                                      e: (name: any, attributes?: Object, text?: any) => XMLDocumentCB;

                                        method ele

                                        ele: {
                                        (name: any, attributes?: Object, text?: any): XMLDocumentCB;
                                        (name: string, value?: Object): XMLDocumentCB;
                                        };

                                          method element

                                          element: {
                                          (name: any, attributes?: Object, text?: any): XMLDocumentCB;
                                          (name: string, value?: Object): XMLDocumentCB;
                                          };
                                          • Creates a child element node.

                                            _Aliases:_ ele and e

                                            Parameter name

                                            element node name or a JS object defining the nodes to insert

                                            Parameter attributes

                                            node attributes

                                            Parameter text

                                            node text

                                            Returns

                                            the document builder object

                                          method end

                                          end: () => void;
                                          • Ends the document and calls the onEnd callback function.

                                          method ent

                                          ent: (
                                          name: string,
                                          value: string | { pubID?: string; sysID?: string; nData?: string }
                                          ) => XMLDocumentCB;

                                            method entity

                                            entity: (
                                            name: string,
                                            value: string | { pubID?: string; sysID?: string; nData?: string }
                                            ) => XMLDocumentCB;
                                            • Creates a general entity declaration.

                                              _Alias:_ ent

                                              Parameter name

                                              the name of the entity

                                              Parameter value

                                              entity parameters

                                              Returns

                                              the document builder object

                                            method i

                                            i: {
                                            (target: string, value: any): XMLDocumentCB;
                                            (array: any[]): XMLDocumentCB;
                                            (obj: Object): XMLDocumentCB;
                                            };

                                              method ins

                                              ins: {
                                              (target: string, value: any): XMLDocumentCB;
                                              (array: any[]): XMLDocumentCB;
                                              (obj: Object): XMLDocumentCB;
                                              };

                                                method instruction

                                                instruction: {
                                                (target: string, value: any): XMLDocumentCB;
                                                (array: any[]): XMLDocumentCB;
                                                (obj: Object): XMLDocumentCB;
                                                };
                                                • Creates a new processing instruction node and appends it to the list of child nodes.

                                                  _Aliases:_ ins and i

                                                  Parameter target

                                                  node target

                                                  Parameter value

                                                  node value

                                                  Returns

                                                  the document builder object

                                                method n

                                                n: (name: string, attributes?: Object, text?: any) => XMLDocumentCB;

                                                  method nod

                                                  nod: (name: string, attributes?: Object, text?: any) => XMLDocumentCB;

                                                    method node

                                                    node: (name: string, attributes?: Object, text?: any) => XMLDocumentCB;
                                                    • Creates a new child node and appends it to the list of child nodes.

                                                      _Aliases:_ nod and n

                                                      Parameter name

                                                      element node name

                                                      Parameter attributes

                                                      node attributes

                                                      Parameter text

                                                      node text

                                                      Returns

                                                      the document builder object

                                                    method not

                                                    not: (name: string, value: { pubID?: string; sysID?: string }) => XMLDocumentCB;

                                                      method notation

                                                      notation: (
                                                      name: string,
                                                      value: { pubID?: string; sysID?: string }
                                                      ) => XMLDocumentCB;
                                                      • Creates a notation declaration.

                                                        _Alias:_ not

                                                        Parameter name

                                                        the name of the entity

                                                        Parameter value

                                                        entity parameters

                                                        Returns

                                                        the document builder object

                                                      method pent

                                                      pent: (
                                                      name: string,
                                                      value: string | { pubID?: string; sysID?: string }
                                                      ) => XMLDocumentCB;

                                                        method pEntity

                                                        pEntity: (
                                                        name: string,
                                                        value: string | { pubID?: string; sysID?: string }
                                                        ) => XMLDocumentCB;
                                                        • Creates a parameter entity declaration.

                                                          _Alias:_ pent

                                                          Parameter name

                                                          the name of the entity

                                                          Parameter value

                                                          entity parameters

                                                          Returns

                                                          the document builder object

                                                        method r

                                                        r: (value: string) => XMLDocumentCB;

                                                          method raw

                                                          raw: (value: string) => XMLDocumentCB;
                                                          • Creates a new raw text node and appends it to the list of child nodes.

                                                            _Alias:_ r

                                                            Parameter value

                                                            node value

                                                            Returns

                                                            the document builder object

                                                          method t

                                                          t: (value: string) => XMLDocumentCB;

                                                            method text

                                                            text: (value: string) => XMLDocumentCB;
                                                            • Creates a new text node and appends it to the list of child nodes.

                                                              _Aliases:_ txt and t

                                                              Parameter value

                                                              node value

                                                              Returns

                                                              the document builder object

                                                            method txt

                                                            txt: (value: string) => XMLDocumentCB;

                                                              method u

                                                              u: () => XMLDocumentCB;

                                                                method up

                                                                up: () => XMLDocumentCB;
                                                                • Moves up to the parent node.

                                                                  _Alias:_ u

                                                                  Returns

                                                                  the document builder object

                                                                class XMLDTDAttList

                                                                class XMLDTDAttList {}
                                                                • Represents an attribute list in the DTD.

                                                                property attributeName

                                                                attributeName: string;
                                                                • Attribute name

                                                                property attributeType

                                                                attributeType: string;
                                                                • Type of the attribute

                                                                property defaultValue

                                                                defaultValue: string;
                                                                • Default value of the attribute (only used for #FIXED or #DEFAULT)

                                                                property defaultValueType

                                                                defaultValueType: string;
                                                                • Default value type (either #REQUIRED, #IMPLIED, #FIXED or #DEFAULT)

                                                                property elementName

                                                                elementName: string;
                                                                • The name of the element containing this attribute

                                                                method toString

                                                                toString: (options?: XMLToStringOptions) => string;
                                                                • Converts the node to string.

                                                                  Parameter options

                                                                  conversion options

                                                                class XMLDTDElement

                                                                class XMLDTDElement {}
                                                                • Represents an element in the DTD.

                                                                property name

                                                                name: string;
                                                                • The name of the element

                                                                property value

                                                                value: string;
                                                                • Element content

                                                                method toString

                                                                toString: (options?: XMLToStringOptions) => string;
                                                                • Converts the node to string.

                                                                  Parameter options

                                                                  conversion options

                                                                class XMLDTDEntity

                                                                class XMLDTDEntity {}
                                                                • Represents an entity in the DTD.

                                                                property name

                                                                name: string;
                                                                • The name of the entity

                                                                property nData

                                                                nData: string;
                                                                • Notation declaration

                                                                property pe

                                                                pe: boolean;
                                                                • Determines whether this is a parameter entity (true) or a general entity (false).

                                                                property pubID

                                                                pubID: string;
                                                                • Public identifier

                                                                property sysID

                                                                sysID: string;
                                                                • System identifier

                                                                method toString

                                                                toString: (options?: XMLToStringOptions) => string;
                                                                • Converts the node to string.

                                                                  Parameter options

                                                                  conversion options

                                                                class XMLDTDNotation

                                                                class XMLDTDNotation {}
                                                                • Represents a notation in the DTD.

                                                                property name

                                                                name: string;
                                                                • The name of the notation

                                                                property pubID

                                                                pubID: string;
                                                                • Public identifier

                                                                property sysID

                                                                sysID: string;
                                                                • System identifier

                                                                method toString

                                                                toString: (options?: XMLToStringOptions) => string;
                                                                • Converts the node to string.

                                                                  Parameter options

                                                                  conversion options

                                                                class XMLElement

                                                                class XMLElement extends XMLNode {}
                                                                • Represents an element node.

                                                                property attribs

                                                                attribs: { string: XMLAttribute };
                                                                • Element attributes

                                                                property name

                                                                name: string;
                                                                • Element node name

                                                                method a

                                                                a: (name: any, value?: any) => XMLElement;

                                                                  method att

                                                                  att: (name: any, value?: any) => XMLElement;

                                                                    method attribute

                                                                    attribute: (name: any, value?: any) => XMLElement;
                                                                    • Adds or modifies an attribute.

                                                                      _Aliases:_ att, a

                                                                      Parameter name

                                                                      attribute name

                                                                      Parameter value

                                                                      attribute value

                                                                      Returns

                                                                      the parent element node

                                                                    method clone

                                                                    clone: () => XMLElement;
                                                                    • Creates a clone of this node

                                                                    method removeAttribute

                                                                    removeAttribute: (name: string | string[]) => XMLElement;
                                                                    • Removes an attribute.

                                                                      Parameter name

                                                                      attribute name

                                                                      Returns

                                                                      the parent element node

                                                                    method toString

                                                                    toString: (options?: XMLToStringOptions) => string;
                                                                    • Converts the node to string.

                                                                      Parameter options

                                                                      conversion options

                                                                    class XMLNode

                                                                    abstract class XMLNode {}
                                                                    • Represents the base class of XML nodes.

                                                                    property children

                                                                    children: XMLNode[];
                                                                    • Child nodes

                                                                    property parent

                                                                    parent: XMLElement;
                                                                    • Parent element node

                                                                    property type

                                                                    type: NodeType;
                                                                    • Type of the node

                                                                    method a

                                                                    a: (name: any, value?: any) => XMLElement;

                                                                      method att

                                                                      att: (name: any, value?: any) => XMLElement;

                                                                        method attribute

                                                                        attribute: (name: any, value?: any) => XMLElement;
                                                                        • Adds or modifies an attribute.

                                                                          _Aliases:_ att, a

                                                                          Parameter name

                                                                          attribute name

                                                                          Parameter value

                                                                          attribute value

                                                                          Returns

                                                                          the parent element node

                                                                        method c

                                                                        c: (value: string) => XMLElement;

                                                                          method cdata

                                                                          cdata: (value: string) => XMLElement;
                                                                          • Creates a new CDATA node and appends it to the list of child nodes.

                                                                            _Aliases:_ dat and d

                                                                            Parameter value

                                                                            node value

                                                                            Returns

                                                                            the parent node

                                                                          method com

                                                                          com: (value: string) => XMLElement;

                                                                            method comment

                                                                            comment: (value: string) => XMLElement;
                                                                            • Creates a new comment node and appends it to the list of child nodes.

                                                                              _Aliases:_ com and c

                                                                              Parameter value

                                                                              node value

                                                                              Returns

                                                                              the parent node

                                                                            method commentAfter

                                                                            commentAfter: (value: string) => XMLElement;
                                                                            • Creates a comment node after the current node

                                                                              Parameter value

                                                                              node value

                                                                              Returns

                                                                              the parent node

                                                                            method commentBefore

                                                                            commentBefore: (value: string) => XMLElement;
                                                                            • Creates a comment node before the current node

                                                                              Parameter value

                                                                              node value

                                                                              Returns

                                                                              the parent node

                                                                            method d

                                                                            d: (value: string) => XMLElement;

                                                                              method dat

                                                                              dat: (value: string) => XMLElement;

                                                                                method dec

                                                                                dec: (
                                                                                version?:
                                                                                | string
                                                                                | { version?: string; encoding?: string; standalone?: boolean },
                                                                                encoding?: string,
                                                                                standalone?: boolean
                                                                                ) => XMLElement;

                                                                                  method declaration

                                                                                  declaration: (
                                                                                  version?:
                                                                                  | string
                                                                                  | { version?: string; encoding?: string; standalone?: boolean },
                                                                                  encoding?: string,
                                                                                  standalone?: boolean
                                                                                  ) => XMLElement;
                                                                                  • Creates the XML declaration.

                                                                                    _Alias:_ dec

                                                                                    Parameter version

                                                                                    version number string, e.g. 1.0

                                                                                    Parameter encoding

                                                                                    encoding declaration, e.g. UTF-8

                                                                                    Parameter standalone

                                                                                    standalone document declaration: true or false

                                                                                    Returns

                                                                                    the root element node

                                                                                  method doc

                                                                                  doc: () => XMLDocument;

                                                                                    method doctype

                                                                                    doctype: (
                                                                                    pubID?: string | { pubID?: string; sysID?: string },
                                                                                    sysID?: string
                                                                                    ) => XMLDocType;
                                                                                    • Creates the document type definition.

                                                                                      _Alias:_ dtd

                                                                                      Parameter pubID

                                                                                      public identifier of the DTD

                                                                                      Parameter sysID

                                                                                      system identifier of the DTD

                                                                                      Returns

                                                                                      the DOCTYPE node

                                                                                    method document

                                                                                    document: () => XMLDocument;
                                                                                    • Returns the document node.

                                                                                      _Alias:_ doc

                                                                                    method dtd

                                                                                    dtd: (
                                                                                    pubID?: string | { pubID?: string; sysID?: string },
                                                                                    sysID?: string
                                                                                    ) => XMLDocType;

                                                                                      method e

                                                                                      e: (name: any, attributes?: Object, text?: any) => XMLElement;

                                                                                        method ele

                                                                                        ele: (name: any, attributes?: Object, text?: any) => XMLElement;

                                                                                          method element

                                                                                          element: (name: any, attributes?: Object, text?: any) => XMLElement;
                                                                                          • Creates a new child node and appends it to the list of child nodes.

                                                                                            _Aliases:_ ele and e

                                                                                            Parameter name

                                                                                            node name or a JS object defining the nodes to insert

                                                                                            Parameter attributes

                                                                                            node attributes

                                                                                            Parameter text

                                                                                            node text

                                                                                            Returns

                                                                                            the last top level node created

                                                                                          method end

                                                                                          end: (options?: XMLWriter | XMLToStringOptions) => string;
                                                                                          • Converts the XML document to string.

                                                                                            Parameter options

                                                                                            conversion options

                                                                                          method i

                                                                                          i: {
                                                                                          (target: string, value: any): XMLElement;
                                                                                          (array: any[]): XMLElement;
                                                                                          (obj: Object): XMLElement;
                                                                                          };

                                                                                            method importDocument

                                                                                            importDocument: (doc: XMLNode) => XMLElement;
                                                                                            • Takes the root node of the given XML document and appends it to child nodes.

                                                                                              Parameter doc

                                                                                              the document whose root node to import

                                                                                              Returns

                                                                                              the current node

                                                                                            method ins

                                                                                            ins: {
                                                                                            (target: string, value: any): XMLElement;
                                                                                            (array: any[]): XMLElement;
                                                                                            (obj: Object): XMLElement;
                                                                                            };

                                                                                              method insertAfter

                                                                                              insertAfter: (name: any, attributes?: Object, text?: any) => XMLElement;
                                                                                              • Creates a new sibling node and inserts it after this node.

                                                                                                Parameter name

                                                                                                node name or a JS object defining the nodes to insert

                                                                                                Parameter attributes

                                                                                                node attributes

                                                                                                Parameter text

                                                                                                node text

                                                                                                Returns

                                                                                                the new node

                                                                                              method insertBefore

                                                                                              insertBefore: (name: any, attributes?: Object, text?: any) => XMLElement;
                                                                                              • Creates a new sibling node and inserts it before this node.

                                                                                                Parameter name

                                                                                                node name or a JS object defining the nodes to insert

                                                                                                Parameter attributes

                                                                                                node attributes

                                                                                                Parameter text

                                                                                                node text

                                                                                                Returns

                                                                                                the new node

                                                                                              method instruction

                                                                                              instruction: {
                                                                                              (target: string, value: any): XMLElement;
                                                                                              (array: any[]): XMLElement;
                                                                                              (obj: Object): XMLElement;
                                                                                              };
                                                                                              • Creates a new processing instruction node and appends it to the list of child nodes.

                                                                                                _Aliases:_ ins and i

                                                                                                Parameter target

                                                                                                node target

                                                                                                Parameter value

                                                                                                node value

                                                                                                Returns

                                                                                                the parent node

                                                                                              method instructionAfter

                                                                                              instructionAfter: (target: string, value: any) => XMLElement;
                                                                                              • Creates a processing instruction node after the current node.

                                                                                                Parameter target

                                                                                                node target

                                                                                                Parameter value

                                                                                                node value

                                                                                                Returns

                                                                                                the parent node

                                                                                              method instructionBefore

                                                                                              instructionBefore: (target: string, value: any) => XMLElement;
                                                                                              • Creates a processing instruction node before the current node.

                                                                                                Parameter target

                                                                                                node target

                                                                                                Parameter value

                                                                                                node value

                                                                                                Returns

                                                                                                the parent node

                                                                                              method n

                                                                                              n: (name: string, attributes?: Object, text?: any) => XMLElement;

                                                                                                method next

                                                                                                next: () => XMLNode;
                                                                                                • Returns the next sibling node.

                                                                                                method nod

                                                                                                nod: (name: string, attributes?: Object, text?: any) => XMLElement;

                                                                                                  method node

                                                                                                  node: (name: string, attributes?: Object, text?: any) => XMLElement;
                                                                                                  • Creates a new element node and appends it to the list of child nodes.

                                                                                                    _Aliases:_ nod and n

                                                                                                    Parameter name

                                                                                                    element node name

                                                                                                    Parameter attributes

                                                                                                    node attributes

                                                                                                    Parameter text

                                                                                                    node text

                                                                                                    Returns

                                                                                                    the node created

                                                                                                  method prev

                                                                                                  prev: () => XMLNode;
                                                                                                  • Returns the previous sibling node.

                                                                                                  method r

                                                                                                  r: (value: string) => XMLElement;

                                                                                                    method raw

                                                                                                    raw: (value: string) => XMLElement;
                                                                                                    • Creates a new raw text node and appends it to the list of child nodes.

                                                                                                      _Alias:_ r

                                                                                                      Parameter value

                                                                                                      node value

                                                                                                      Returns

                                                                                                      the parent node

                                                                                                    method remove

                                                                                                    remove: () => XMLElement;
                                                                                                    • Removes this node from the tree.

                                                                                                      Returns

                                                                                                      the parent node

                                                                                                    method root

                                                                                                    root: () => XMLElement;
                                                                                                    • Returns the root element node.

                                                                                                    method t

                                                                                                    t: (value: string) => XMLElement;

                                                                                                      method text

                                                                                                      text: (value: string) => XMLElement;
                                                                                                      • Creates a new text node and appends it to the list of child nodes.

                                                                                                        _Aliases:_ txt and t

                                                                                                        Parameter value

                                                                                                        node value

                                                                                                        Returns

                                                                                                        the parent node

                                                                                                      method txt

                                                                                                      txt: (value: string) => XMLElement;

                                                                                                        method u

                                                                                                        u: () => XMLElement;

                                                                                                          method up

                                                                                                          up: () => XMLElement;
                                                                                                          • Returns the parent node.

                                                                                                            _Alias:_ u

                                                                                                          class XMLProcessingInstruction

                                                                                                          class XMLProcessingInstruction extends XMLCharacterData {}
                                                                                                          • Represents a processing instruction node.

                                                                                                          property target

                                                                                                          target: string;
                                                                                                          • Instruction target

                                                                                                          method clone

                                                                                                          clone: () => XMLProcessingInstruction;
                                                                                                          • Creates a clone of this node

                                                                                                          method toString

                                                                                                          toString: (options?: XMLToStringOptions) => string;
                                                                                                          • Converts the node to string

                                                                                                            Parameter options

                                                                                                            conversion options

                                                                                                          class XMLRaw

                                                                                                          class XMLRaw extends XMLCharacterData {}
                                                                                                          • Represents a raw text node.

                                                                                                          method clone

                                                                                                          clone: () => XMLRaw;
                                                                                                          • Creates a clone of this node

                                                                                                          method toString

                                                                                                          toString: (options?: XMLToStringOptions) => string;
                                                                                                          • Converts the node to string

                                                                                                            Parameter options

                                                                                                            conversion options

                                                                                                          class XMLText

                                                                                                          class XMLText extends XMLCharacterData {}
                                                                                                          • Represents a text node.

                                                                                                          method clone

                                                                                                          clone: () => XMLText;
                                                                                                          • Creates a clone of this node

                                                                                                          method toString

                                                                                                          toString: (options?: XMLToStringOptions) => string;
                                                                                                          • Converts the node to string

                                                                                                            Parameter options

                                                                                                            conversion options

                                                                                                          Interfaces

                                                                                                          interface BeginOptions

                                                                                                          interface BeginOptions {}
                                                                                                          • Defines the options used while creating an XML document with the begin function.

                                                                                                          property ignoreDecorators

                                                                                                          ignoreDecorators?: boolean;
                                                                                                          • Whether decorator strings will be ignored when converting JS objects

                                                                                                          property invalidCharReplacement

                                                                                                          invalidCharReplacement?: string;
                                                                                                          • A character to replace invalid characters in all values. This also disables character validation.

                                                                                                          property keepNullAttributes

                                                                                                          keepNullAttributes?: boolean;
                                                                                                          • Whether attributes with null values will be kept or ignored

                                                                                                          property keepNullNodes

                                                                                                          keepNullNodes?: boolean;
                                                                                                          • Whether nodes with null values will be kept or ignored

                                                                                                          property noDoubleEncoding

                                                                                                          noDoubleEncoding?: boolean;
                                                                                                          • Whether existing html entities are encoded

                                                                                                          property noValidation

                                                                                                          noValidation?: boolean;
                                                                                                          • Whether values will be validated and escaped or returned as is

                                                                                                          property separateArrayItems

                                                                                                          separateArrayItems?: boolean;
                                                                                                          • Whether array items are created as separate nodes when passed as an object value

                                                                                                          property stringify

                                                                                                          stringify?: XMLStringifier;
                                                                                                          • A set of functions to use for converting values to strings

                                                                                                          property writer

                                                                                                          writer?: XMLWriter | WriterOptions;
                                                                                                          • The default XML writer to use for converting nodes to string. If the default writer is not set, the built-in XMLStringWriter will be used instead.

                                                                                                          interface CreateOptions

                                                                                                          interface CreateOptions {}
                                                                                                          • Defines the options used while creating an XML document with the create function.

                                                                                                          property encoding

                                                                                                          encoding?: string;
                                                                                                          • Encoding declaration, e.g. UTF-8

                                                                                                          property headless

                                                                                                          headless?: boolean;
                                                                                                          • Whether XML declaration and doctype will be included

                                                                                                          property ignoreDecorators

                                                                                                          ignoreDecorators?: boolean;
                                                                                                          • Whether decorator strings will be ignored when converting JS objects

                                                                                                          property invalidCharReplacement

                                                                                                          invalidCharReplacement?: string;
                                                                                                          • A character to replace invalid characters in all values. This also disables character validation.

                                                                                                          property keepNullAttributes

                                                                                                          keepNullAttributes?: boolean;
                                                                                                          • Whether attributes with null values will be kept or ignored

                                                                                                          property keepNullNodes

                                                                                                          keepNullNodes?: boolean;
                                                                                                          • Whether nodes with null values will be kept or ignored

                                                                                                          property noDoubleEncoding

                                                                                                          noDoubleEncoding?: boolean;
                                                                                                          • Whether existing html entities are encoded

                                                                                                          property noValidation

                                                                                                          noValidation?: boolean;
                                                                                                          • Whether values will be validated and escaped or returned as is

                                                                                                          property pubID

                                                                                                          pubID?: string;
                                                                                                          • Public identifier of the DTD

                                                                                                          property separateArrayItems

                                                                                                          separateArrayItems?: boolean;
                                                                                                          • Whether array items are created as separate nodes when passed as an object value

                                                                                                          property standalone

                                                                                                          standalone?: boolean;
                                                                                                          • Standalone document declaration: true or false

                                                                                                          property stringify

                                                                                                          stringify?: XMLStringifier;
                                                                                                          • A set of functions to use for converting values to strings

                                                                                                          property sysID

                                                                                                          sysID?: string;
                                                                                                          • System identifier of the DTD

                                                                                                          property version

                                                                                                          version?: string;
                                                                                                          • A version number string, e.g. 1.0

                                                                                                          property writer

                                                                                                          writer?: XMLWriter;
                                                                                                          • The default XML writer to use for converting nodes to string. If the default writer is not set, the built-in XMLStringWriter will be used instead.

                                                                                                          interface WriterOptions

                                                                                                          interface WriterOptions {}
                                                                                                          • Defines the options passed to the XML writer.

                                                                                                          property allowEmpty

                                                                                                          allowEmpty?: boolean;
                                                                                                          • Whether to output closing tags for empty element nodes

                                                                                                          property dontPrettyTextNodes

                                                                                                          dontPrettyTextNodes?: boolean;
                                                                                                          • Whether to pretty print text nodes

                                                                                                          property indent

                                                                                                          indent?: string;
                                                                                                          • Indentation string for pretty printing

                                                                                                          property newline

                                                                                                          newline?: string;
                                                                                                          • Newline string for pretty printing

                                                                                                          property offset

                                                                                                          offset?: number;
                                                                                                          • A fixed number of indents to offset strings

                                                                                                          property pretty

                                                                                                          pretty?: boolean;
                                                                                                          • Pretty print the XML tree

                                                                                                          property spaceBeforeSlash

                                                                                                          spaceBeforeSlash?: string | boolean;
                                                                                                          • A string to insert before closing slash character

                                                                                                          property state

                                                                                                          state?: WriterState;
                                                                                                          • The current state of the writer

                                                                                                          property user

                                                                                                          user?: any;
                                                                                                          • User state object that is saved between writer functions

                                                                                                          property width

                                                                                                          width?: number;
                                                                                                          • Maximum column width

                                                                                                          property writer

                                                                                                          writer?: XMLWriter;
                                                                                                          • Writer function overrides

                                                                                                          interface XMLStringifier

                                                                                                          interface XMLStringifier {}
                                                                                                          • Defines the functions used for converting values to strings.

                                                                                                          property attEscape

                                                                                                          attEscape?: (v: string) => string;
                                                                                                          • Escapes special characters in attribute values.

                                                                                                          property attValue

                                                                                                          attValue?: (v: any) => string;
                                                                                                          • Converts attribute value to string

                                                                                                          property cdata

                                                                                                          cdata?: (v: any) => string;
                                                                                                          • Converts the contents of a CDATA node to string

                                                                                                          property comment

                                                                                                          comment?: (v: any) => string;
                                                                                                          • Converts the contents of a comment node to string

                                                                                                          property convertAttKey

                                                                                                          convertAttKey?: string;
                                                                                                          • When prepended to a JS object key, converts the key-value pair to an attribute.

                                                                                                          property convertCDataKey

                                                                                                          convertCDataKey?: string;
                                                                                                          • When prepended to a JS object key, converts its value to a CDATA node.

                                                                                                          property convertCommentKey

                                                                                                          convertCommentKey?: string;
                                                                                                          • When prepended to a JS object key, converts its value to a comment node.

                                                                                                          property convertPIKey

                                                                                                          convertPIKey?: string;
                                                                                                          • When prepended to a JS object key, converts the key-value pair to a processing instruction node.

                                                                                                          property convertRawKey

                                                                                                          convertRawKey?: string;
                                                                                                          • When prepended to a JS object key, converts its value to a raw text node.

                                                                                                          property convertTextKey

                                                                                                          convertTextKey?: string;
                                                                                                          • When prepended to a JS object key, converts its value to a text node.

                                                                                                            _Note:_ Since JS objects cannot contain duplicate keys, multiple text nodes can be created by adding some unique text after each object key. For example: { '#text1': 'some text', '#text2': 'more text' };

                                                                                                          property dtdAttDefault

                                                                                                          dtdAttDefault?: (v: any) => string;
                                                                                                          • Converts !ATTLIST node default value inside DocType to string

                                                                                                          property dtdAttType

                                                                                                          dtdAttType?: (v: any) => string;
                                                                                                          • Converts !ATTLIST node type inside DocType to string

                                                                                                          property dtdElementValue

                                                                                                          dtdElementValue?: (v: any) => string;
                                                                                                          • Converts !ELEMENT node content inside Doctype to string

                                                                                                          property dtdEntityValue

                                                                                                          dtdEntityValue?: (v: any) => string;
                                                                                                          • Converts !ENTITY node content inside Doctype to string

                                                                                                          property dtdNData

                                                                                                          dtdNData?: (v: any) => string;
                                                                                                          • Converts !NOTATION node content inside Doctype to string

                                                                                                          property dtdPubID

                                                                                                          dtdPubID?: (v: any) => string;
                                                                                                          • Converts DocType public identifier to string

                                                                                                          property dtdSysID

                                                                                                          dtdSysID?: (v: any) => string;
                                                                                                          • Converts DocType system identifier to string

                                                                                                          property insTarget

                                                                                                          insTarget?: (v: any) => string;
                                                                                                          • Converts processing instruction target to string

                                                                                                          property insValue

                                                                                                          insValue?: (v: any) => string;
                                                                                                          • Converts processing instruction value to string

                                                                                                          property name

                                                                                                          name?: (v: any) => string;
                                                                                                          • Converts an element or attribute name to string

                                                                                                          property raw

                                                                                                          raw?: (v: any) => string;
                                                                                                          • Converts the contents of a raw text node to string

                                                                                                          property text

                                                                                                          text?: (v: any) => string;
                                                                                                          • Converts the contents of a text node to string

                                                                                                          property textEscape

                                                                                                          textEscape?: (v: string) => string;
                                                                                                          • Escapes special characters in text.

                                                                                                          property xmlEncoding

                                                                                                          xmlEncoding?: (v: any) => string;
                                                                                                          • Converts XML encoding to string

                                                                                                          property xmlStandalone

                                                                                                          xmlStandalone?: (v: any) => string;
                                                                                                          • Converts standalone document declaration to string

                                                                                                          property xmlVersion

                                                                                                          xmlVersion?: (v: any) => string;
                                                                                                          • Converts XML version to string

                                                                                                          interface XMLToStringOptions

                                                                                                          interface XMLToStringOptions {}
                                                                                                          • Defines the settings used when converting the XML document to string.

                                                                                                          property allowEmpty

                                                                                                          allowEmpty?: boolean;
                                                                                                          • Whether to output closing tags for empty element nodes

                                                                                                          property dontPrettyTextNodes

                                                                                                          dontPrettyTextNodes?: boolean;
                                                                                                          • Whether to pretty print text nodes

                                                                                                          property indent

                                                                                                          indent?: string;
                                                                                                          • Indentation string for pretty printing

                                                                                                          property newline

                                                                                                          newline?: string;
                                                                                                          • Newline string for pretty printing

                                                                                                          property offset

                                                                                                          offset?: number;
                                                                                                          • A fixed number of indents to offset strings

                                                                                                          property pretty

                                                                                                          pretty?: boolean;
                                                                                                          • Pretty print the XML tree

                                                                                                          property spaceBeforeSlash

                                                                                                          spaceBeforeSlash?: string | boolean;
                                                                                                          • A string to insert before closing slash character

                                                                                                          property width

                                                                                                          width?: number;
                                                                                                          • Maximum column width

                                                                                                          property writer

                                                                                                          writer?: XMLWriter;
                                                                                                          • The default XML writer to use for converting nodes to string. If the default writer is not set, the built-in XMLStringWriter will be used instead.

                                                                                                          interface XMLWriter

                                                                                                          interface XMLWriter {}
                                                                                                          • Represents a writer which outputs an XML document.

                                                                                                          property attribute

                                                                                                          attribute?: (att: XMLAttribute, options: WriterOptions, level: number) => any;
                                                                                                          • Writes an attribute.

                                                                                                            Parameter att

                                                                                                            current attribute

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property cdata

                                                                                                          cdata?: (node: XMLCData, options: WriterOptions, level: number) => any;
                                                                                                          • Writes a CDATA node.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property closeAttribute

                                                                                                          closeAttribute?: (
                                                                                                          att: XMLAttribute,
                                                                                                          options: WriterOptions,
                                                                                                          level: number
                                                                                                          ) => void;
                                                                                                          • Called right before completing writing an attribute. This function does not produce any output, but can be used to alter the state of the writer.

                                                                                                            Parameter node

                                                                                                            current attribute

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property closeNode

                                                                                                          closeNode?: (node: XMLNode, options: WriterOptions, level: number) => void;
                                                                                                          • Called right before completing writing a node. This function does not produce any output, but can be used to alter the state of the writer.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property comment

                                                                                                          comment?: (node: XMLComment, options: WriterOptions, level: number) => any;
                                                                                                          • Writes a comment node.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property declaration

                                                                                                          declaration?: (
                                                                                                          node: XMLDeclaration,
                                                                                                          options: WriterOptions,
                                                                                                          level: number
                                                                                                          ) => any;
                                                                                                          • Writes the XML declaration (e.g. <?xml version="1.0"?>).

                                                                                                            Parameter node

                                                                                                            XML declaration node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property docType

                                                                                                          docType?: (node: XMLDocType, options: WriterOptions, level: number) => any;
                                                                                                          • Writes the DocType node and its children.

                                                                                                            _Note:_ Be careful when overriding this function as this function is also responsible for writing the internal subset of the DTD.

                                                                                                            Parameter node

                                                                                                            DOCTYPE node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property dtdAttList

                                                                                                          dtdAttList?: (node: XMLDTDAttList, options: WriterOptions, level: number) => any;
                                                                                                          • Writes an attribute node (!ATTLIST) inside the DTD.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property dtdElement

                                                                                                          dtdElement?: (node: XMLDTDElement, options: WriterOptions, level: number) => any;
                                                                                                          • Writes an element node (!ELEMENT) inside the DTD.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property dtdEntity

                                                                                                          dtdEntity?: (node: XMLDTDEntity, options: WriterOptions, level: number) => any;
                                                                                                          • Writes an entity node (!ENTITY) inside the DTD.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property dtdNotation

                                                                                                          dtdNotation?: (
                                                                                                          node: XMLDTDNotation,
                                                                                                          options: WriterOptions,
                                                                                                          level: number
                                                                                                          ) => any;
                                                                                                          • Writes a notation node (!NOTATION) inside the DTD.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property element

                                                                                                          element?: (node: XMLElement, options: WriterOptions, level: number) => any;
                                                                                                          • Writes an element node.

                                                                                                            _Note:_ Be careful when overriding this function as this function is also responsible for writing the element attributes and child nodes.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property endline

                                                                                                          endline?: (node: XMLNode, options: WriterOptions, level: number) => any;
                                                                                                          • Writes the newline string.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property indent

                                                                                                          indent?: (node: XMLNode, options: WriterOptions, level: number) => any;
                                                                                                          • Writes the indentation string for the given level.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property openAttribute

                                                                                                          openAttribute?: (
                                                                                                          att: XMLAttribute,
                                                                                                          options: WriterOptions,
                                                                                                          level: number
                                                                                                          ) => void;
                                                                                                          • Called right after starting writing an attribute. This function does not produce any output, but can be used to alter the state of the writer.

                                                                                                            Parameter node

                                                                                                            current attribute

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property openNode

                                                                                                          openNode?: (node: XMLNode, options: WriterOptions, level: number) => void;
                                                                                                          • Called right after starting writing a node. This function does not produce any output, but can be used to alter the state of the writer.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property processingInstruction

                                                                                                          processingInstruction?: (
                                                                                                          node: XMLProcessingInstruction,
                                                                                                          options: WriterOptions,
                                                                                                          level: number
                                                                                                          ) => any;
                                                                                                          • Writes a processing instruction node.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property raw

                                                                                                          raw?: (node: XMLRaw, options: WriterOptions, level: number) => any;
                                                                                                          • Writes a raw text node.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          property text

                                                                                                          text?: (node: XMLText, options: WriterOptions, level: number) => any;
                                                                                                          • Writes a text node.

                                                                                                            Parameter node

                                                                                                            current node

                                                                                                            Parameter options

                                                                                                            writer options and state information

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          Enums

                                                                                                          enum NodeType

                                                                                                          enum NodeType {
                                                                                                          Element = 1,
                                                                                                          Attribute = 2,
                                                                                                          Text = 3,
                                                                                                          CData = 4,
                                                                                                          EntityReference = 5,
                                                                                                          EntityDeclaration = 6,
                                                                                                          ProcessingInstruction = 7,
                                                                                                          Comment = 8,
                                                                                                          Document = 9,
                                                                                                          DocType = 10,
                                                                                                          DocumentFragment = 11,
                                                                                                          NotationDeclaration = 12,
                                                                                                          Declaration = 201,
                                                                                                          Raw = 202,
                                                                                                          AttributeDeclaration = 203,
                                                                                                          ElementDeclaration = 204,
                                                                                                          }
                                                                                                          • Defines the type of a node in the XML document.

                                                                                                          member Attribute

                                                                                                          Attribute = 2
                                                                                                          • An attribute node

                                                                                                          member AttributeDeclaration

                                                                                                          AttributeDeclaration = 203
                                                                                                          • An attribute declaraiton node inside DocType

                                                                                                          member CData

                                                                                                          CData = 4
                                                                                                          • A CDATA node

                                                                                                          member Comment

                                                                                                          Comment = 8
                                                                                                          • A comment node

                                                                                                          member Declaration

                                                                                                          Declaration = 201
                                                                                                          • An XML declaration node

                                                                                                          member DocType

                                                                                                          DocType = 10
                                                                                                          • A Doctype node

                                                                                                          member Document

                                                                                                          Document = 9
                                                                                                          • A document node

                                                                                                          member DocumentFragment

                                                                                                          DocumentFragment = 11
                                                                                                          • A document fragment node

                                                                                                          member Element

                                                                                                          Element = 1
                                                                                                          • An element node

                                                                                                          member ElementDeclaration

                                                                                                          ElementDeclaration = 204
                                                                                                          • An element declaration node inside DocType

                                                                                                          member EntityDeclaration

                                                                                                          EntityDeclaration = 6
                                                                                                          • An entity declaration node inside DocType

                                                                                                          member EntityReference

                                                                                                          EntityReference = 5
                                                                                                          • An entity reference node inside DocType

                                                                                                          member NotationDeclaration

                                                                                                          NotationDeclaration = 12
                                                                                                          • A notation declaration node inside DocType

                                                                                                          member ProcessingInstruction

                                                                                                          ProcessingInstruction = 7
                                                                                                          • A processing instruction node

                                                                                                          member Raw

                                                                                                          Raw = 202
                                                                                                          • A raw text node

                                                                                                          member Text

                                                                                                          Text = 3
                                                                                                          • A text node

                                                                                                          enum WriterState

                                                                                                          enum WriterState {
                                                                                                          None = 0,
                                                                                                          OpenTag = 1,
                                                                                                          InsideTag = 2,
                                                                                                          CloseTag = 3,
                                                                                                          }
                                                                                                          • Defines the state of the writer.

                                                                                                          member CloseTag

                                                                                                          CloseTag = 3
                                                                                                          • Writer is at a closing tag, e.g. </node>

                                                                                                          member InsideTag

                                                                                                          InsideTag = 2
                                                                                                          • Writer is inside an element

                                                                                                          member None

                                                                                                          None = 0
                                                                                                          • Writer state is unknown

                                                                                                          member OpenTag

                                                                                                          OpenTag = 1
                                                                                                          • Writer is at an opening tag, e.g. <node>

                                                                                                          Type Aliases

                                                                                                          type OnDataCallback

                                                                                                          type OnDataCallback = (chunk: string, level: number) => void;
                                                                                                          • A function to be called when a chunk of XML is written.

                                                                                                            Parameter chunk

                                                                                                            a chunk of string that was written

                                                                                                            Parameter level

                                                                                                            current depth of the XML tree

                                                                                                          type OnEndCallback

                                                                                                          type OnEndCallback = () => void;
                                                                                                          • A function to be called when the XML doucment is completed.

                                                                                                          Package Files (1)

                                                                                                          Dependencies (0)

                                                                                                          No dependencies.

                                                                                                          Dev Dependencies (8)

                                                                                                          Peer Dependencies (0)

                                                                                                          No peer dependencies.

                                                                                                          Badge

                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/xmlbuilder.

                                                                                                          • Markdown
                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/xmlbuilder)
                                                                                                          • HTML
                                                                                                            <a href="https://www.jsdocs.io/package/xmlbuilder"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>