DOM API

Contents


Name Description
RevertingException

Throwing this exception will revert the transaction.

Objects

Name Description
XopusAttribute

The Xopus specific implementation of an Attribute node.

XopusComment

The Xopus specific implementation of a Comment node.

XopusDocument

The Xopus specific implementation of a Document node.

XopusDocumentFragment

The Xopus specific implementation of a DocumentFragment node.

XopusElement

The Xopus specific implementation of an Element node.

XopusEvent

This page describes a basic event in Xopus. It is not an event in itself.

XopusNamedNodeMap

The Xopus specific implementation of a NamedNodeMap.

XopusNameList

The Xopus specific implementation of a NameList.

XopusNode

The Xopus specific implementation of a generic node.

XopusNodeList

The Xopus specific implementation of a NodeList.

XopusProcessingInstruction

The Xopus specific implementation of a ProcessingInstruction node.

XopusRange

A range consists of a beginning and an end of a selection.

XopusText

The Xopus specific implementation of a Text node.

Methods

XopusAttribute Methods

Name Description
getOwnerElement

Retrieve the owner element of this attribute.

showLookup

Opens the lookup for the attribute node.

XopusDocument Methods

Name Description
createAttribute

Create a new attribute node.

createAttributeNS

Create a new attribute node in a namespace.

createComment

Create a new comment node.

createDocumentFragment

Create a new document fragment.

createElement

Create a new element node.

createElementNS

Create a new element node in a namespace.

createProcessingInstruction

Create a new processing instruction.

createRange

Creates an XopusRange Object.

createTextNode

Create a new text node.

getDocumentElement

Get the root element of this document.

getDocumentURI

Get the uri for this document.

getElementsByTagName

Retrieve a list of child elements by the name given.

getElementsByTagNameNS

Retrieve a list of child elements by the name and the namespace URI given.

getSchemaURI

Get the URI used to load the schema for this document.

hasRunningTransactions

Checks whether the document has running transactions, actions that are being performed.

hasUnsavedChanges

See if this document has unsaved changes.

importNode

Import a node from another document into the current document.

registerNamespacePrefix

Register a namespace prefix to be used in XPaths for the selectSingleNode() and selectNodes() methods.

save

Save this document. This will call the save XML function set on IO object.

setDocumentURI

Set the URI for this document. This URI will be passed to the save XML function set on the IO object.

XopusElement Methods

Name Description
getAllowedAttributes

Get the allowed attributes for this element.

getAllowedChildren

Get the allowed children for this element.

getAttribute

Retrieve the value of the attribute with the given name.

getAttributeNode

Retrieve the attribute with the given name.

getAttributeNodeNS

Retrieve the attribute node with the given name and namespace.

getAttributeNS

Retrieve the value of the attribute with the given name and namespace.

getAttributes

Get the attribute nodes for this node.

getColspan

Get's the span of a cell in a table, based on Xopus' internal table model. This can be used in API calls to do things with table cells.

getContentType

Retrieve the content type for this element.

getInnerXML

Get the serialized XML for the child nodes of this node.

hasAttribute

See if this element has an attribute with the given name.

hasAttributeNS

See if this element has an attribute with the given name and namespace.

insertNear

Convenience method that searches for a valid insert position for a given node and inserts it there.

isIgnoreMixed

This function can be used to find out if an element is ignoring it's mixed status. This can be used to when executing specific code to 'correct' an element's content.

makeComplete

This methods will append required children to an empty element so that it becomes schema valid. If the content model contains a mandatory choice, Xopus will show a dialog requesting the user to make the choice between the different possible content models.

openAttributesEditor

Opens the attributes editor for the node.

removeAttribute

Remove the attribute with the given name from this element.

removeAttributeNode

Remove the attribute from this element.

removeAttributeNS

Remove the attribute with the given name and namespace from this element.

setAttribute

Set the value of the attribute with the given name.

setAttributeNode

Add the attribute to this element.

setAttributeNodeNS

Add the attribute to this element.

setAttributeNS

Set the value of the attribute with the given name and namespace.

XopusEvent Methods

Name Description
preventDefault

Deprecated. Use Editor.RevertingException to cancel changes in an event handler.

stopPropagation

Stops the event from propagating to higher level nodes.

XopusNameList Methods

Name Description
contains

Test if the given name exists in this list.

containsNS

Test if the given name, namespaceURI pair exists in this list.

getDisplayName

This method can be used to get the pretty name for the item in the XopusNameList.

getName

Get the name of the item at the given index.

getNamedItem

Get an item from the collection.

getNamedItemNS

Get an item from the collection.

getNamespaceURI (2)

Get the namespaceURI of the item at the given index in the NameList.

XopusNode Methods

Name Description
addEventListener

Register an object as a listener to certain events.

addSimpleListener

Deprecated. Use addEventListener instead.

appendChild

Append the given child to this node.

canAppendChild

See if we can append the given child to this node. It assumes that the given childNode is an orphan.

canInsertAfter

See if we can insert the given child in this node. It assumes that the given childNode is an orphan.

canInsertBefore

See if we can insert the given child in this node. It assumes that the given childNode is an orphan.

canPrependChild

See if we can prepend the given child to this node. It assumes that the given childNode is an orphan.

canRemoveChild

See if we can remove the given child from this node.

canReplaceChild

See if we can replace the new child with an old child. It assumes that the given childNode is an orphan.

cloneNode

This will make a clone of this node.

compareDocumentPosition

Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to the document order.

getAnnotation

Get the schema annotation for this node.

getChildNodes

Get the collection of child nodes of this node.

getFirstChild

Get the first child node of this node.

getIndex

Get the index of the current element in it's parent's child nodes collection.

getLastChild

Get the last child node of this node.

getLocalName

Get the local name (without prefix) of this node.

getNamespaceURI (1)

Get the namespace URI of this node.

getNextSibling

Get the next sibling of this node.

getNodeName

Get the node name of this node.

getNodeType

Returns the node type of this node. Xopus follows the node type numbers from the W3C DOM standard.

getNodeValue

Get the node value of this node.

getOwnerDocument

Get the owner document of this node.

getParentNode

Get the parent node of this node.

getPrefix

Get the prefix of this node.

getPrettyName

Get the pretty name in the current interface language for this node as specified in the schema or in the nodeConfig configuration.

getPreviousSibling

Get the previous sibling of this node.

getTextContent

Get the text content for this node.

getXML

Get the serialized XML for this node.

hasChildNodes

Determine whether this node has children.

highlight

Highlights the node with an attention border.

insertAfter

Add a new child to this node, after the referenced node.

insertBefore

Add a new child to this node, before the referenced node.

isDefaultNamespace

Test if this namespace is the default namespace for this node.

isValid

Test whether this node is schema valid.

lookupNamespaceURI

Request the namespaceURI for the given prefix.

lookupPrefix

Request the prefix for the given namespaceURI. If there is more than one prefix, the shortest will be returned.

makeValid

This methods will add required children to an element, remove or replace invalid existing children so that it becomes schema valid. If the content model contains a mandatory choice, Xopus will show a dialog requesting the user to make the choice between the different possible content models.

prependChild

Prepend the given child to this node.

removeChild

Remove the given child from this node.

removeEventListener

Unregister an object that is a listener to a certain event.

selectNodes

Select multiple nodes using an XPath.

selectSingleNode

Select a single node using an XPath.

setNodeValue

Set the node value of this node.

setTextContent

Set the text content for this element. Replaces all child nodes with one text node.

unhighlight

Removed highlighting from the node. This will remove any attentionborder that was set by highlight

XopusNodeList Methods

Name Description
getLength

Retrieve the number of nodes in this collection.

item

Get an item from the collection.

removeAll

Remove all nodes in this collection.

XopusProcessingInstruction Methods

Name Description
getTarget

Get the target for this processing instruction.

XopusRange Methods

Name Description
cloneContents

Clones the contents of the current range.

cloneRange

Clones the range object.

collapse

Can be used to collapse a range.

compareBoundaryPoints

Compare two XopusRange objects.

deleteContents

Delete the contents of the current selection.

extractContents

Remove the contents of the current selection and return them in a DocumentFragment

getCommonAncestorContainer

Get the common ancestor container for this range.

getEndContainer

Extra getter function for compatibility with HTMLRange.

getEndOffset

Extra getter function for compatibility with HTMLRange.

getStartContainer

Extra getter function for compatibility with HTMLRange.

getStartOffset

Extra getter function for compatibility with HTMLRange.

insertNode

Inserts a node at the start of the Range.

isCollapsed

See if this range is collapsed.

selectNode

Select an entire node. The start DOM point will be set before the opening tag and the end DOM point will be set after the closing tag.

selectNodeContents

Select all the contents of a node. The start DOM point will be set before the opening tag and the end DOM point will be set after the closing tag.

setEnd

Set the end point of the range.

setEndAfter

Set the end point at the first DOM point after the specified node.

setEndBefore

Set the end point at the first DOM point before the specified node.

setStart

Set the start point of the range.

setStartAfter

Set the start point at the first DOM point after the specified node.

setStartBefore

Set the start point at the first DOM point before the specified node.

surroundContents

Insert the contents of this range in the given node and insert the node where the contents were.

XopusText Methods

Name Description
isElementContentWhitespace

Returns whether this text node contains element content whitespace.

Other Methods

Name Description
appendData

Append the string to the end of the character data of the node.

canAppendData

Determines if data can be appended.

canDeleteData

Determines if data can be deleted.

canInsertData

Determines if data can be inserted.

canReplaceData

Determines if data can be replaced.

canSetData

Determines if data can be set.

deleteData

Remove a range of characters from the node.

getData

Gets the character data of the node.

insertData

Insert a string at the specified character offset.

isWhitespaceOnly

Test if this text node contains only whitespace. This method does not check the schema if this text node can be considered ignorable whitespace. Use the isElementContentWhitespace method instead.

removeSimpleListener

Unregister a function that is a listener to a certain event.

replaceData

Replace the characters starting at the specified character offset with the specified string.

setData

Sets the character data of the node.

splitText

This will split this node at the given index.

Events

Name Description
DOMAttrModified

This event fires when an attribute is inserted, removed, or changed.

DOMCharacterDataModified

This event will be fired after the value of the target of this event was changed.

DOMNodeInserted

This event will be fired after a node was inserted in the target node of this event.

DOMNodeInsertedIntoDocument

This event will be fired when the target node of this event will be connected to the DOM tree. This event will be fired for all descendants of an orphan subtree that is added to the DOM.

DOMNodeRemoved

This event will be fired before a node will be removed from the target node of this event.

DOMNodeRemovedFromDocument

This event will be fired when the target node of this event will be disconnected from the DOM tree. This event will be fired for all descendants of the subtree that is removed from the DOM.

DOMSubtreeModified

This event will be fired after a descendant of the target of this event was changed.

XopusAfterAttrInserted

This event will be fired after an attribute was added to the target element of this event.

XopusAfterAttrModified

This event will be fired after an attribute of the target element of this event was modified. It will not get fired when the attribute is removed or inserted, listen to XopusAfterAttrRemoved or XopusAfterAttrInserted for that.

XopusAfterAttrRemoved

This event will be fired after an attribute was removed from the target element of this event.

XopusAfterChildInserted

This event will be fired after a node was inserted in the target node of this event.

XopusAfterChildRemoved

This event will be fired after a node was removed from the target node of this event.

XopusAfterNodeCreated

This event will be fired after a new node was created by the target document of this event.

XopusAfterNodeMerged

This event will be fired after a node was merged with the target node of this event.

XopusAfterNodeMoved

This event will be fired after the target of this event was moved.

XopusAfterNodeSplit

This event will be fired after the target of this event was split in two nodes.

XopusAfterNodeValueModified

This event will be fired after the value of the target of this event was changed.

XopusAfterPaste

This event after pasted content has been inserted into the document and paste has completed.

XopusAfterSubtreeModified

This event will be fired after a descendant of the target of this event was changed.

XopusBeforeAttrInserted

This event will be fired before an attribute will be added to the target element of this event.

XopusBeforeAttrModified

This event will be fired before an attribute of the target element of this event is modified. It will not get fired when the attribute is removed or inserted, listen to XopusBeforeAttrRemoved or XopusBeforeAttrInserted for that.

XopusBeforeAttrRemoved

This event will be fired before an attribute will be removed from the target element of this event.

XopusBeforeChildInserted

This event will be fired before a node will be inserted in the target node of this event.

XopusBeforeChildRemoved

This event will be fired before a node will be removed from the target node of this event.

XopusBeforeNodeCreated

This event will be fired before a node will be created by the target document of this event.

XopusBeforeNodeMerged

This event will be fired before a node will be merged with the target node of this event.

XopusBeforeNodeMoved

This event will be fired before the target node of this event will be moved.

XopusBeforeNodeSplit

This event will be fired before the target node of this event will be split at the given index.

XopusBeforeNodeValueModified

This event will be fired before the value of the target node of this event will be changed.

XopusBeforePaste

This event fires before paste content is inserted.

XopusBeforeSubtreeModified

This event will be fired before a descendant or the target node of this event will be changed.

XopusNodeInsertedIntoDocument

This event will be fired when the target node of this event will be connected to the DOM tree. This event will be fired for all descendants of an orphan subtree that is added to the DOM.

XopusNodeRemovedFromDocument

This event will be fired when the target node of this event will be disconnected from the DOM tree. This event will be fired for all descendants of the subtree that is removed from the DOM.

Exceptions

Name Description
DOMException

This event can be used to catch errors relating to DOM Operations.