XMLDocument

external class XMLDocument : Document(source)

An XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents.

MDN Reference

Properties

Link copied to clipboard

Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document.

Link copied to clipboard
Link copied to clipboard

Returns node's node document's document base URL.

Link copied to clipboard

Specifies the beginning and end of the document body.

Link copied to clipboard

node is a CDATASection node.

Link copied to clipboard

Returns document's encoding.

Link copied to clipboard
Link copied to clipboard

Returns the children.

Link copied to clipboard

Returns the child elements.

Link copied to clipboard

node is a Comment node.

Link copied to clipboard

Gets a value that indicates whether standards-compliant mode is switched on for the object.

Link copied to clipboard

Returns document's content type.

Link copied to clipboard

Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned.

Link copied to clipboard

Returns the script element, or the SVG script element, that is currently executing, as long as the element represents a classic script. In the case of reentrant script execution, returns the one that most recently started executing amongst those that have not yet finished executing.

Link copied to clipboard

Returns the Window object of the active document.

Link copied to clipboard

Sets or gets a value that indicates whether the document can be edited.

Link copied to clipboard
var dir: String

Sets or retrieves a value that indicates the reading order of the object.

Link copied to clipboard

Gets an object representing the document type declaration associated with the current document.

Link copied to clipboard

node is a DocumentFragment node.

Link copied to clipboard

node is a document.

Link copied to clipboard

Set when other is a descendant of node.

Link copied to clipboard

Set when other is an ancestor of node.

Link copied to clipboard

Set when node and other are not in the same tree.

Link copied to clipboard

Set when other is following node.

Link copied to clipboard

Set when other is preceding node.

Link copied to clipboard

node is a doctype.

Link copied to clipboard

Gets a reference to the root node of the document.

Link copied to clipboard

Returns document's URL.

Link copied to clipboard

node is an element.

Link copied to clipboard

Retrieves a collection of all embed objects in the document.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the first child.

Link copied to clipboard

Returns the first child that is an element, and null otherwise.

Link copied to clipboard
Link copied to clipboard

Retrieves a collection, in source order, of all form objects in the document.

Link copied to clipboard

Returns document's fullscreen element.

Link copied to clipboard

Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise.

Link copied to clipboard

Returns the head element.

Link copied to clipboard
Link copied to clipboard

Retrieves a collection, in source order, of img objects in the document.

Link copied to clipboard

Gets the implementation object of the current document.

Link copied to clipboard

Returns true if node is connected and false otherwise.

Link copied to clipboard

Returns the last child.

Link copied to clipboard

Returns the last child that is an element, and null otherwise.

Link copied to clipboard

Gets the date that the page was last modified, if the page supplies one.

Link copied to clipboard

Retrieves a collection of all a objects that specify the href property and all area objects in the document.

Link copied to clipboard

Contains information about the current URL.

Link copied to clipboard

Returns the next sibling.

Link copied to clipboard

Returns a string appropriate for the type of node.

Link copied to clipboard

Returns the type of node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Fires when the user aborts the download.

Link copied to clipboard

Fires when the object loses the input focus.

Link copied to clipboard

Occurs when playback is possible, but would require further buffering.

Link copied to clipboard

Fires when the contents of the object or selection have changed.

Link copied to clipboard

Fires when the user clicks the left mouse button on the object

Link copied to clipboard

Fires when the user clicks the right mouse button in the client area, opening the context menu.

Link copied to clipboard

Fires when the user double-clicks the object.

Link copied to clipboard

Fires on the source object continuously during a drag operation.

Link copied to clipboard

Fires on the source object when the user releases the mouse at the close of a drag operation.

Link copied to clipboard

Fires on the target element when the user drags the object to a valid drop target.

Link copied to clipboard

Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.

Link copied to clipboard

Fires on the target element continuously while the user drags the object over a valid drop target.

Link copied to clipboard

Fires on the source object when the user starts to drag a text selection or selected object.

Link copied to clipboard
Link copied to clipboard

Occurs when the duration attribute is updated.

Link copied to clipboard

Occurs when the media element is reset to its initial state.

Link copied to clipboard

Occurs when the end of playback is reached.

Link copied to clipboard
open var onerror: Function<Unit>?

Fires when an error occurs during object loading.

Link copied to clipboard

Fires when the object receives focus.

Link copied to clipboard
Link copied to clipboard

Fires when the user presses a key.

Link copied to clipboard

Fires when the user releases a key.

Link copied to clipboard

Fires immediately after the browser loads the object.

Link copied to clipboard

Occurs when media data is loaded at the current playback position.

Link copied to clipboard

Occurs when the duration and dimensions of the media have been determined.

Link copied to clipboard

Occurs when Internet Explorer begins looking for media data.

Link copied to clipboard

Fires when the user clicks the object with either mouse button.

Link copied to clipboard

Fires when the user moves the mouse over the object.

Link copied to clipboard

Fires when the user moves the mouse pointer outside the boundaries of the object.

Link copied to clipboard

Fires when the user moves the mouse pointer into the object.

Link copied to clipboard

Fires when the user releases a mouse button while the mouse is over the object.

Link copied to clipboard

Occurs when playback is paused.

Link copied to clipboard

Occurs when the play method is requested.

Link copied to clipboard

Occurs when the audio or video has started playing.

Link copied to clipboard

Occurs to indicate progress while downloading media data.

Link copied to clipboard

Occurs when the playback rate is increased or decreased.

Link copied to clipboard

Fires when the state of the object has changed.

Link copied to clipboard

Fires when the user resets a form.

Link copied to clipboard

Fires when the user repositions the scroll box in the scroll bar on the object.

Link copied to clipboard

Occurs when the seek operation ends.

Link copied to clipboard

Occurs when the current playback position is moved.

Link copied to clipboard

Fires when the current selection changes.

Link copied to clipboard

Occurs when the download has stopped.

Link copied to clipboard

Occurs if the load operation has been intentionally halted.

Link copied to clipboard

Occurs to indicate the current playback position.

Link copied to clipboard

Occurs when the volume is changed, or playback is muted or unmuted.

Link copied to clipboard

Occurs when playback stops because the next frame of a video resource is not available.

Link copied to clipboard
open override val ownerDocument: Void

Returns the node document. Returns null for documents.

Link copied to clipboard

Returns the parent element.

Link copied to clipboard

Returns the parent.

Link copied to clipboard

Return an HTMLCollection of the embed elements in the Document.

Link copied to clipboard
Link copied to clipboard

Returns the previous sibling.

Link copied to clipboard

node is a ProcessingInstruction node.

Link copied to clipboard

Retrieves a value that indicates the current state of the object.

Link copied to clipboard

Gets the URL of the location that referred the user to the current page.

Link copied to clipboard

Retrieves a collection of all script objects in the document.

Link copied to clipboard
Link copied to clipboard

Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.

Link copied to clipboard

node is a Text node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Contains the title of the document.

Link copied to clipboard
val URL: String

Sets or gets the URL for the current document.

Functions

Link copied to clipboard
fun <T : Node> adoptNode(node: T): T

Moves node from another document and returns it.

Link copied to clipboard
open fun append(vararg nodes: Any)

Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun cloneNode(deep: Boolean = definedExternally): Node

Returns a copy of node. If deep is true, the copy also includes the node's descendants.

Link copied to clipboard
fun close()

Closes an output stream and forces the sent data to display.

Link copied to clipboard

Returns a bitmask indicating the position of other relative to node.

Link copied to clipboard
fun contains(other: Node?): Boolean

Returns true if other is an inclusive descendant of node, and false otherwise.

Link copied to clipboard
fun createAttribute(localName: String): Attr

Creates an attribute object with a specified name.

Link copied to clipboard
fun createAttributeNS(namespace: String?, qualifiedName: String): Attr
Link copied to clipboard

Returns a CDATASection node whose data is data.

Link copied to clipboard

Creates a comment object with the specified data.

Link copied to clipboard

Creates a new document.

Link copied to clipboard
fun createElement(tagName: String, options: ElementCreationOptions = definedExternally): HTMLElement

fun <T : HTMLElement> createElement(tagName: HtmlTagName<T>, options: ElementCreationOptions = definedExternally): T

Creates an instance of the element for the specified tag.

Link copied to clipboard
Link copied to clipboard
fun <T : MathMLElement> createElementNS(namespaceURI: MATHML_NAMESPACE, qualifiedName: MathMLTagName<T>): T
fun <T : SVGElement> createElementNS(namespaceURI: SVG_NAMESPACE, qualifiedName: SvgTagName<T>): T
fun createElementNS(namespace: String?, qualifiedName: String, options: String = definedExternally): Element
fun createElementNS(namespace: String?, qualifiedName: String, options: ElementCreationOptions): Element
Link copied to clipboard
open fun createExpression(expression: String, resolver: XPathNSResolver? = definedExternally): XPathExpression
Link copied to clipboard
fun createNodeIterator(root: Node, whatToShow: Int = definedExternally, filter: NodeFilter? = definedExternally): NodeIterator

Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.

Link copied to clipboard

Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown.

Link copied to clipboard

Returns an empty range object that has both of its boundary points positioned at the beginning of the document.

Link copied to clipboard

Creates a text string from the specified value.

Link copied to clipboard
fun createTreeWalker(root: Node, whatToShow: Int = definedExternally, filter: NodeFilter? = definedExternally): TreeWalker

Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.

Link copied to clipboard
Link copied to clipboard

Returns the element for the specified x coordinate and the specified y coordinate.

Link copied to clipboard
Link copied to clipboard
open fun evaluate(expression: String, contextNode: Node, resolver: XPathNSResolver? = definedExternally, type: Short = definedExternally, result: XPathResult? = definedExternally): XPathResult
Link copied to clipboard
suspend fun exitFullscreen()

Stops document's fullscreen element from being displayed fullscreen and resolves promise when done.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun getElementById(elementId: String): HTMLElement?

Returns a reference to the first object with the specified value of the ID attribute.

Link copied to clipboard

Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.

Link copied to clipboard

Gets a collection of objects based on the value of the NAME or ID attribute.

Link copied to clipboard

Retrieves a collection of objects based on the specified element name.

Link copied to clipboard
fun getRootNode(options: GetRootNodeOptions = definedExternally): Node

Returns node's root.

Link copied to clipboard

Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.

Link copied to clipboard

Returns whether node has children.

Link copied to clipboard

Gets a value indicating whether the object currently has focus.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T : Node> importNode(node: T, deep: Boolean = definedExternally): T

Returns a copy of node. If deep is true, the copy also includes the node's descendants.

Link copied to clipboard
fun <T : Node> insertBefore(node: T, child: Node?): T
Link copied to clipboard
Link copied to clipboard
fun isEqualNode(otherNode: Node?): Boolean

Returns whether node and otherNode have the same properties.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun normalize()

Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.

Link copied to clipboard
fun open(unused1: String = definedExternally, unused2: String = definedExternally): Document

Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.

fun open(url: String, name: String, features: String): WindowProxy?
fun open(url: URL, name: String, features: String): WindowProxy?
Link copied to clipboard
open fun prepend(vararg nodes: Any)

Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.

Link copied to clipboard
open fun querySelector(selectors: String): Element?
open fun <T : MathMLElement> querySelector(selectors: MathMLTagName<T>): T?
open fun <T : SVGElement> querySelector(selectors: SvgTagName<T>): T?

open fun <T : HTMLElement> querySelector(selectors: HtmlTagName<T>): T?

Returns the first element that is a descendant of node that matches selectors.

Link copied to clipboard
open fun querySelectorAll(selectors: String): NodeListOf<Element>
open fun <T : SVGElement> querySelectorAll(selectors: SvgTagName<T>): NodeListOf<T>

open fun <T : HTMLElement> querySelectorAll(selectors: HtmlTagName<T>): NodeListOf<T>

Returns all element descendants of node that match selectors.

Link copied to clipboard
fun <T : Node> removeChild(child: T): T
Link copied to clipboard
fun <T : Node> replaceChild(node: Node, child: T): T
Link copied to clipboard
open fun replaceChildren(vararg nodes: Any)

Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun write(vararg text: String)

Writes one or more HTML expressions to a document in the specified window.

Link copied to clipboard
fun writeln(vararg text: String)

Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.