Options
All
  • Public
  • Public/Protected
  • All
Menu

Class XmlCharRef

Represents an XML character reference.

An XML character reference is structured as follows, where {dec} is the decimal representation code point corresponding to a particular Unicode character:

&#{dec};

The corresponding hexadecimal version is structured as follows, where {hex} is the hexadecimal representation code point corresponding to a particular Unicode character:

&#x{hex};

Unicode characters outside of the Basic Multilingual Plane are represented using a surrogate pair consisting of two character references.

The {dec} and {hex} values are defined by the char and hex properties of this node; the former is the character to be represented while the latter indicates whether the decimal or hexadecimal representation should be used.

XmlCharRef nodes cannot have any children.

Hierarchy

Index

Constructors

constructor

  • new XmlCharRef(char: string, hex?: boolean): XmlCharRef
  • Initializes a new instance of the XmlCharRef class.

    Parameters

    • char: string

      The character to represent using the reference.

    • Default value hex: boolean = false

      Whether to use the hexadecimal or decimal representation for the reference. If left undefined, decimal is the default.

    Returns XmlCharRef

Properties

Private _char

_char: string

Protected _children

_children: XmlNode[]

Private _hex

_hex: boolean

Accessors

char

  • get char(): string
  • set char(char: string): void
  • Gets the character to represent using the reference.

    Returns string

    The character to represent using the reference.

  • Sets the character to represent using the reference.

    Parameters

    • char: string

      The character to represent using the reference.

    Returns void

    The character to represent using the reference.

hex

  • get hex(): boolean
  • set hex(hex: boolean): void
  • Gets whether or not to use the hexadecimal or decimal representation for the reference.

    Returns boolean

    Whether or not to use the hexadecimal or decimal representation for the reference.

  • Sets whether or not to use the hexadecimal or decimal representation for the reference.

    Parameters

    • hex: boolean

      Whether or not to use the hexadecimal or decimal representation for the reference.

    Returns void

    Whether or not to use the hexadecimal or decimal representation for the reference.

parent

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

    Returns XmlNode | undefined

    The parent of this node.

Methods

children

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

    Returns XmlNode[]

    This method does not return.

insertChild

  • Throws an exception since XmlCharRef 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 XmlCharRef 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 XmlCharRef 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