Options
All
  • Public
  • Public/Protected
  • All
Menu

Class XmlDtd

Represents an XML document type definition (DTD).

An XML document type definition is structured as follows, where {name} is the name of the DTD, {sysId} is the system identifier of the DTD, {pubId} is the public identifier of the DTD, and {intSubset} is the internal subset of the DTD:

<!DOCTYPE {name} SYSTEM "{sysId}" PUBLIC "{pubId}" [
    {intSubset}
]>

The {name}, {pubId}, and {sysId} values are properties of the node, while the {intSubset} value consists of the children of this node.

XmlDtd nodes can have an unlimited number of XmlComment, XmlDtdAttlist, XmlDtdElement, XmlDtdEntity, XmlDtdNotation, XmlDtdParamEntityRef, and XmlProcInst nodes.

Hierarchy

Index

Constructors

constructor

  • new XmlDtd(name: string, sysId?: string, pubId?: string): XmlDtd
  • Initializes a new instance of the XmlDtd class.

    Parameters

    • name: string

      The name of the DTD.

    • Optional sysId: string

      The system identifier of the DTD, excluding quotation marks.

    • Optional pubId: string

      The public identifier of the DTD, excluding quotation marks. If a public identifier is provided, a system identifier must be provided as well.

    Returns XmlDtd

Properties

Protected _children

_children: XmlNode[]

Private _name

_name: string

Private Optional _pubId

_pubId: string

Private Optional _sysId

_sysId: string

Accessors

name

  • get name(): string
  • set name(name: string): void
  • Gets the name of the DTD.

    Returns string

    The name of the DTD.

  • Sets the name of the DTD.

    Parameters

    • name: string

      The name of the DTD.

    Returns void

    The name of the DTD.

parent

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

    Returns XmlNode | undefined

    The parent of this node.

pubId

  • get pubId(): string | undefined
  • set pubId(pubId: string | undefined): void
  • Gets the public identifier of the DTD, excluding quotation marks.

    Returns string | undefined

    The public identifier of the DTD, excluding quotation marks. This value may be undefined.

  • Sets the public identifier of the DTD, excluding quotation marks. If a public identifier is provided, a system identifier must be provided as well.

    Parameters

    • pubId: string | undefined

      The public identifier of the DTD, excluding quotation marks. This value may be undefined.

    Returns void

    The public identifier of the DTD, excluding quotation marks. This value may be undefined.

sysId

  • get sysId(): string | undefined
  • set sysId(sysId: string | undefined): void
  • Gets the system identifier of the DTD, excluding quotation marks.

    Returns string | undefined

    The system identifier of the DTD, excluding quotation marks. This value may be undefined.

  • Sets the system identifier of the DTD, excluding quotation marks.

    Parameters

    • sysId: string | undefined

      The system identifier of the DTD, excluding quotation marks. This value may be undefined.

    Returns void

    The system identifier of the DTD, excluding quotation marks. This value may be undefined.

Methods

attlist

  • Inserts a new attribute-list declaration at the specified index. If no index is specified, the node is inserted at the end of this node's children.

    Parameters

    • text: string

      The text of the attribute-list declaration.

    • Optional index: number

      The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.

    Returns XmlDtdAttlist

    The newly created attribute-list declaration.

children

  • Gets this node's children.

    Throws an exception if this node cannot have any children. Consult the appropriate subclass documentation for more details.

    Returns XmlNode[]

    This node's children.

comment

  • comment(content: string, index?: number): XmlComment
  • Inserts a new comment at the specified index. If no index is specified, the node is inserted at the end of this node's children.

    Parameters

    • content: string

      The data of the comment.

    • Optional index: number

      The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.

    Returns XmlComment

    The newly created comment.

element

  • Inserts a new element declaration at the specified index. If no index is specified, the node is inserted at the end of this node's children.

    Parameters

    • text: string

      The text of the element declaration.

    • Optional index: number

      The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.

    Returns XmlDtdElement

    The newly created element declaration.

entity

  • Inserts a new entity declaration at the specified index. If no index is specified, the node is inserted at the end of this node's children.

    Parameters

    • text: string

      The text of the entity declaration.

    • Optional index: number

      The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.

    Returns XmlDtdEntity

    The newly created entity declaration.

insertChild

  • Inserts the specified node into this node's children at the specified index. The node is not inserted if it is already present. If this node already has a parent, it is removed from that parent.

    Only XmlComment, XmlDtdAttlist, XmlDtdElement, XmlDtdEntity, XmlDtdNotation, and XmlProcInst nodes can be inserted; otherwise an exception will be thrown.

    Parameters

    • node: XmlNode

      The node to insert.

    • Optional index: number

      The index at which to insert the node. Nodes at or after the index are shifted to the right. If no index is specified, the node is inserted at the end.

    Returns XmlNode | undefined

    The node inserted into this node's children, or undefined if no node was inserted.

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.

notation

  • Inserts a new notation declaration at the specified index. If no index is specified, the node is inserted at the end of this node's children.

    Parameters

    • text: string

      The text of the notation declaration.

    • Optional index: number

      The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.

    Returns XmlDtdNotation

    The newly created notation declaration.

paramEntityRef

  • Inserts a new parameter entity reference at the specified index. If no index is specified, the node is inserted at the end of this node's children.

    Parameters

    • entity: string

      The entity to reference.

    • Optional index: number

      The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.

    Returns XmlDtdParamEntityRef

    The newly created parameter entity reference.

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.

procInst

  • procInst(target: string, content?: string, index?: number): XmlProcInst
  • Inserts a new processing instruction at the specified index. If no index is specified, the node is inserted at the end of this node's children.

    Parameters

    • target: string

      The target of the processing instruction.

    • Optional content: string

      The data of the processing instruction, or undefined if there is no target.

    • Optional index: number

      The index at which the node should be inserted. If no index is specified, the node is inserted at the end of this node's children.

    Returns XmlProcInst

    The newly created processing instruction.

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
  • Removes the specified node from this node's children.

    Throws an exception if this node cannot have any children, or if the specified node cannot be removed. Consult the appropriate subclass documentation for more details.

    Parameters

    • node: XmlNode

      The node to remove.

    Returns boolean

    Whether a node was removed.

removeChildAtIndex

  • removeChildAtIndex(index: number): XmlNode
  • Removes the node at the specified index from this node's children.

    Throws an exception if this node cannot have any children, or if the node at the specified index cannot be removed. Consult the appropriate subclass documentation for more details.

    Parameters

    • index: number

      The index at which the node to be removed is located.

    Returns XmlNode

    The node that was removed.

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