ltxmlts
    Preparing search index...

    Class XDeclaration

    Represents the XML declaration (<?xml ...?>).

    XDeclaration is not a node; it is held by XDocument and serialized at the beginning of the document output.

    const decl = new XDeclaration('1.0', 'UTF-8', 'yes');
    decl.toString(); // "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>"
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    encoding: string

    The character encoding, e.g. "UTF-8". Empty string if omitted.

    standalone: string

    The standalone flag ("yes" or "no"). Empty string if omitted.

    version: string

    The XML version, typically "1.0".

    Methods

    • Compares this declaration to another by version, encoding, and standalone.

      Parameters

      Returns boolean

      true if all three fields are equal.

    • Returns the XML declaration string, e.g. <?xml version='1.0' encoding='UTF-8'?>.

      Returns string

      The serialized XML declaration.