A document type declaration within an XML document.

<!DOCTYPE kittens [
<!ELEMENT kittens (#PCDATA)>
]>

Hierarchy (view full)

Constructors

Properties

end: number = -1

Ending byte offset of this node in the original XML string, or -1 if the offset is unknown.

internalSubset: null | string

Internal subset of this document type declaration, or null if no internal subset was present.

name: string

Name of the root element described by this document type declaration.

parent: null | XmlElement | XmlDocument = null

Parent node of this node, or null if this node has no parent.

publicId: null | string

Public identifier of the external subset of this document type declaration, or null if no public identifier was present.

start: number = -1

Starting byte offset of this node in the original XML string, or -1 if the offset is unknown.

systemId: null | string

System identifier of the external subset of this document type declaration, or null if no system identifier was present.

TYPE_CDATA: "cdata" = 'cdata'

Type value for an XmlCdata node.

TYPE_COMMENT: "comment" = 'comment'

Type value for an XmlComment node.

TYPE_DOCUMENT: "document" = 'document'

Type value for an XmlDocument node.

TYPE_DOCUMENT_TYPE: "doctype" = 'doctype'

Type value for an XmlDocumentType node.

TYPE_ELEMENT: "element" = 'element'

Type value for an XmlElement node.

TYPE_PROCESSING_INSTRUCTION: "pi" = 'pi'

Type value for an XmlProcessingInstruction node.

TYPE_TEXT: "text" = 'text'

Type value for an XmlText node.

TYPE_XML_DECLARATION: "xmldecl" = 'xmldecl'

Type value for an XmlDeclaration node.

Accessors

  • get isRootNode(): boolean
  • Whether this node is the root node of the document (also known as the document element).

    Returns boolean

  • get preserveWhitespace(): boolean
  • Whether whitespace should be preserved in the content of this element and its children.

    This is influenced by the value of the special xml:space attribute, and will be true for any node whose xml:space attribute is set to "preserve". If a node has no such attribute, it will inherit the value of the nearest ancestor that does (if any).

    Returns boolean

  • get type(): string
  • Type of this node.

    The value of this property is a string that matches one of the static TYPE_* properties on the XmlNode class (e.g. TYPE_ELEMENT, TYPE_TEXT, etc.).

    The XmlNode class itself is a base class and doesn't have its own type name.

    Returns string

Methods