OpenXmlSdkTs - v1.0.7
    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

    • Creates a new XDeclaration from explicit values or by copying another.

      Parameters

      • version: string

        The XML version string.

      • encoding: string

        The encoding name (pass "" to omit).

      • standalone: string

        The standalone value (pass "" to omit).

      Returns XDeclaration

    • Parameters

      Returns XDeclaration

    Properties

    version: string

    The XML version, typically "1.0".

    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.

    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.