Skip to content

@miy2/xml-api


Class: Document

Represents the entire XML document.

Extends

Constructors

Constructor

new Document(): Document

Returns

Document

Overrides

Node.constructor

Properties

CDATA_SECTION_NODE

readonly CDATA_SECTION_NODE: 4 = 4

Inherited from

Node.CDATA_SECTION_NODE


COMMENT_NODE

readonly COMMENT_NODE: 8 = 8

Inherited from

Node.COMMENT_NODE


DOCUMENT_NODE

readonly DOCUMENT_NODE: 9 = 9

Inherited from

Node.DOCUMENT_NODE


ELEMENT_NODE

readonly ELEMENT_NODE: 1 = 1

Inherited from

Node.ELEMENT_NODE


model

protected model: ModelNode

Inherited from

Node.model


nodeFilter

nodeFilter: (node) => boolean | null = null


ownerDocument

ownerDocument: Document | null

Inherited from

Node.ownerDocument


TEXT_NODE

readonly TEXT_NODE: 3 = 3

Inherited from

Node.TEXT_NODE

Accessors

childNodes

Get Signature

get childNodes(): NodeList

Returns a NodeList containing all children of this node, respecting the document's filter.

Returns

NodeList

Inherited from

Node.childNodes


documentElement

Get Signature

get documentElement(): Element | null

Returns

Element | null

Set Signature

set documentElement(element): void

Parameters
element

Element | null

Returns

void


firstChild

Get Signature

get firstChild(): Node | null

Returns

Node | null

Inherited from

Node.firstChild


lastChild

Get Signature

get lastChild(): Node | null

Returns

Node | null

Inherited from

Node.lastChild


nextSibling

Get Signature

get nextSibling(): Node | null

Returns

Node | null

Inherited from

Node.nextSibling


nodeName

Get Signature

get nodeName(): string

Returns

string

Overrides

Node.nodeName


nodeType

Get Signature

get nodeType(): number

Returns

number

Overrides

Node.nodeType


parentNode

Get Signature

get parentNode(): Node | null

Returns the parent of this node.

Returns

Node | null

Inherited from

Node.parentNode


previousSibling

Get Signature

get previousSibling(): Node | null

Returns

Node | null

Inherited from

Node.previousSibling


textContent

Get Signature

get textContent(): string | null

Returns

string | null

Set Signature

set textContent(value): void

Parameters
value

string | null

Returns

void

Inherited from

CDATASection.textContent

Methods

accepts()

accepts(node): boolean

Checks if a node is accepted by the current filter.

Parameters

node

ModelNode

Returns

boolean


appendChild()

appendChild<T>(newChild): T

Adds a node to the end of the list of children of a specified parent node.

Type Parameters

T

T extends Node

Parameters

newChild

T

The node to append.

Returns

T

Inherited from

Node.appendChild


createCDATASection()

createCDATASection(data): CDATASection

Parameters

data

string

Returns

CDATASection


createComment()

createComment(data): Comment

Parameters

data

string

Returns

Comment


createElement()

createElement(tagName): Element

Parameters

tagName

string

Returns

Element


createTextNode()

createTextNode(data): Text

Parameters

data

string

Returns

Text


getModel()

getModel(): ModelNode

Returns

ModelNode

Inherited from

Node.getModel


insertBefore()

insertBefore<T>(newChild, refChild): T

Inserts a node before a reference node as a child of this node.

Type Parameters

T

T extends Node

Parameters

newChild

T

The node to insert.

refChild

The reference node (must be a child of this node).

Node | null

Returns

T

Inherited from

Node.insertBefore


notifyAttributeChange()

notifyAttributeChange(element, name, value): void

Parameters

element

Element

name

string

value

string | null

Returns

void


notifyChildAdded()

notifyChildAdded(parent, child, index): void

Parameters

parent

Node

child

Node

index

number

Returns

void


notifyChildRemoved()

notifyChildRemoved(parent, child, index): void

Parameters

parent

Node

child

Node

index

number

Returns

void


notifyChildReplaced()

notifyChildReplaced(parent, newChild, oldChild): void

Parameters

parent

Node

newChild

Node

oldChild

Node

Returns

void


notifyElementTextChange()

notifyElementTextChange(element, text): void

Parameters

element

Element

text

string

Returns

void


notifyTextChange()

notifyTextChange(node, text): void

Parameters

node

CharacterData

text

string

Returns

void


querySelector()

querySelector(selector): Element | null

Parameters

selector

string

Returns

Element | null


querySelectorAll()

querySelectorAll(selector): NodeList

Parameters

selector

string

Returns

NodeList


removeChild()

removeChild<T>(child): T

Removes a child node from the DOM and returns the removed node.

Type Parameters

T

T extends Node

Parameters

child

T

The child node to remove.

Returns

T

Inherited from

Node.removeChild


replaceChild()

replaceChild<T>(newChild, oldChild): T

Replaces a child node with a new node.

Type Parameters

T

T extends Node

Parameters

newChild

T

The new node to add.

oldChild

Node

The child node to be replaced.

Returns

T

Inherited from

Node.replaceChild


setObserver()

setObserver(observer): void

Sets the observer to listen for DOM changes.

Parameters

observer

DOMObserver

Returns

void