DOM provides an interface to navigate and manipulate the hierarchical structure of markup. Most DOM objects are nodes, providing generalized means of navigating from one node to another, changing the children of the node, and other ways of using and modifying the structure of the content.
attributes node
The attributes attribute provides a named node map containing the attributes of the node if it is an element, and NIL otherwise.
child-nodes node
The child-nodes attribute provides a nodelist of all childrens of the node.
first-child node
The first-child attribute provides the first child of the node, or NIL if there are no children.
last-child node
The last-child attribute provides the last child of the node, or NIL if there are no children.
local-name node
The local-name attributes returns the local part of the qualified name of the node as a string. The string is unique for the namespace of the node.
namespace-uri node
The namespace uri of this node.
normalize node
Concatenates adjacent Text nodes and remove empty ones.
previous-sibling node
The previous-sibling attribute provides the node immediately preceeding the node, or NIL if there are no such node. This can for example be used to get the element preceeding a given element.
next-sibling node
The next-sibling attribute provides the node immediately following this node, or NIL if there is no such node. This can be used for example to find the element that follows a given element.
node-name node
The node-name attribute provides the name of the node. The name depends on the type of node, as listed in the DOM specification. Typically, the name is available using a more specialized function than node-name.
node-value node
set-node-value node value
The node-value attribute provides the value of the node. The value depends on the type of the node, as specified in the DOM standard. In most cases, a more specialized function than node-value is used to get the value of a node.
node-type node
The node-type attribute indicates the type of node, matching one of the following constants:
parent-node node
The parent-node attribute refers to the parent of the node. This allow navigation from one node to the node that it belongs to. For example, a script can do something with the element that contains a specific element, such as identifying its name:
(dom:with-open-dom (homepage "home:documents;index.html")
(let ((title-element (dom:item (dom:get-elements-by-tag-name homepage "TITLE") 0)))
(dom:node-name (dom:parent-node title-element))))
; If the homepage document in the example above is correct, the form should result in the value "HEAD", as this is the name of the container of a correctly placed TITLE element.
append-child node new-child
The append-child method adds a node to the end of the list of children of the current node, and returns the added node. If the new child is already in the list of children, it is first removed. If the new node is a document fragment, the entire contents are moved into the child list of this node. The method takes two arguments: the current node, and the node to append.
insert-before node new-child ref-child
The insert-before method inserts a node before a specific child node. The method takes three arguments: The current node, the node to insert, and the optional node before which the new node must be inserted. The method returns the node being inserted.
owner-document node
The document object associated with this node.
prefix node
The namespace prefix of this node, or null if it is unspecified.
replace-child node new-child old-child
The replace-child method replaces a specific child node with a new node in the list of children, and returns the replaced node. It takes three arguments: The current node, the new node to put in the child list, and the node being replaced in the list.
remove-child node old-child
The remove-child method removes a specified child node from the list of children, and returns the removed node. It takes two arguments: The current node, and the node being removed.
supports node feature version
Tests whether the node implements a specific feature.
has-child-nodes node
The has-child-nodes method allow easy determination of whether a node has any children. It returns a true value if the node has children, NIL otherwise. The method takes one argument: The current node.
clone-node node deep
The clone-node method returns a duplicate of a node, except that the clone has no parent. The method takes two arguments: A node to clone, and an optional boolean that indicates whether to recursively clone the children of the node.