Options
All
  • Public
  • Public/Protected
  • All
Menu

Class XmlDecl

Represents an XML declaration.

An XML declaration is structured as follows, where {version} is the XML version, {encoding} is the encoding of the document, and {standalone} is either "yes" or "no", depending on whether the document may contain external markup declarations:

<?xml version="{version}" encoding="{encoding}" standalone="{standalone}"?>

The {version}, {encoding}, and {standalone} values are properties of this node.

XmlDecl nodes cannot have any children.

Hierarchy

Index

Constructors

constructor

Properties

Protected _children

_children: XmlNode[]

Private Optional _encoding

_encoding: string

Private Optional _standalone

_standalone: string

Private _version

_version: string

Accessors

encoding

  • get encoding(): string | undefined
  • set encoding(encoding: string | undefined): void
  • Gets the XML encoding to be included in the declaration.

    Returns string | undefined

    The XML encoding to be included in the declaration. This value may be undefined.

  • Sets the XML encoding to be included in the declaration.

    Parameters

    • encoding: string | undefined

      The XML encoding to be included in the declaration. This value must be a valid encoding. If left undefined, no encoding is included.

    Returns void

    The XML encoding to be included in the declaration. This value may be undefined.

parent

  • get parent(): XmlNode | undefined
  • Gets the parent of this node.

    Returns XmlNode | undefined

    The parent of this node.

standalone

  • get standalone(): string | undefined
  • set standalone(standalone: string | undefined): void
  • Gets the XML standalone attribute to be included in the declaration.

    Returns string | undefined

    The XML standalone attribute to be included in the declaration. This value may be undefined.

  • Sets the XML standalone attribute to be included in the declaration.

    Parameters

    • standalone: string | undefined

      The XML standalone attribute to be included. This value must be "yes" or "no". If left undefined, no standalone attribute is included.

    Returns void

    The XML standalone attribute to be included in the declaration. This value may be undefined.

version

  • get version(): string
  • set version(version: string): void
  • Gets the XML version to be included in the declaration.

    Returns string

    The XML version to tbe included in the declaration.

  • Sets the XML version to be included in the declaration.

    Parameters

    • version: string

      The XML version to be included in the declaration. This value must be a valid XML version number. If left undefined, the default version is "1.0".

    Returns void

    The XML version to tbe included in the declaration.

Methods

children

  • Throws an exception since XmlDecl nodes cannot have any children.

    Returns XmlNode[]

    This method does not return.

insertChild

  • Throws an exception since XmlDecl nodes cannot have any children.

    Parameters

    • node: XmlNode

      This parameter is unused.

    • Optional index: number

      This parameter is unused.

    Returns XmlNode | undefined

    This method does not return.

next

  • Gets the node that follows this one, or undefined if no such node exists or if this node has no parent.

    Returns XmlNode | undefined

    The node that follows this one, or undefined if no such node exists or if this node has no parent.

prev

  • Gets the node that is previous to this one, or undefined if no such node exists or if this node has no parent.

    Returns XmlNode | undefined

    The node that is previous to this one, or undefined if no such node exists or if this node has no parent.

remove

  • Removes this node from its parent if this node has a parent.

    Returns XmlNode | undefined

    This node's parent, or undefined if it has no parent.

removeChild

  • removeChild(node: XmlNode): boolean
  • Throws an exception since XmlDecl nodes cannot have any children.

    Parameters

    • node: XmlNode

      This parameter is unused.

    Returns boolean

    This method does not return.

removeChildAtIndex

  • removeChildAtIndex(index: number): XmlNode
  • Throws an exception since XmlDecl nodes cannot have any children.

    Parameters

    • index: number

      This parameter is unused.

    Returns XmlNode

    This method does not return.

toString

  • Returns an XML string representation of this node.

    Parameters

    • Default value options: IStringOptions = {}

      Formatting options for the string representation.

    Returns string

    An XML string representation of this node.

top

  • Returns the root node of the current hierarchy. If this node has no parent, this node itself is returned.

    Returns XmlNode

    The root node of the current hierarchy.

up

  • Gets the parent of this node.

    Returns XmlNode | undefined

Generated using TypeDoc