Represents an XML document. All elements within the document are descendants of this node.

Hierarchy

Constructors

Properties

Child nodes of this document.

end: number = -1

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

parent: null | XmlElement | XmlDocument = null

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

start: number = -1

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

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 document(): this
  • Document that contains this node, or null if this node is not associated with a document.

    Returns this

  • 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).

    See

    https://www.w3.org/TR/2008/REC-xml-20081126/#sec-white-space

    Returns boolean

  • get text(): string
  • Text content of this document and all its descendants.

    Returns string

  • 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

Generated using TypeDoc