LibreOffice: XNode Interface Reference

LibreOffice LibreOffice 26.2 SDK API Reference

Loading...
Searching...
No Matches
XNode Interface Reference

The primary dom datatype. More...

`import "XNode.idl";`

Inheritance diagram for XNode:

## Public Member Functions
XNode | appendChild ([in] XNode newChild) raises (DOMException)
| Adds the node newChild to the end of the list of children of this node.
XNode | cloneNode ([in] boolean deep)
| Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
XNamedNodeMap | getAttributes ()
| A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
XNodeList | getChildNodes ()
| A NodeList that contains all children of this node.
XNode | getFirstChild ()
| The first child of this node.
XNode | getLastChild ()
| The last child of this node.
string | getLocalName ()
| Returns the local part of the qualified name of this node.
string | getNamespaceURI ()
| The namespace URI of this node, or null if it is unspecified.
XNode | getNextSibling ()
| The node immediately following this node.
string | getNodeName ()
| The name of this node, depending on its type; see the table above.
NodeType | getNodeType ()
| A code representing the type of the underlying object, as defined above.
string | getNodeValue () raises (DOMException)
| The value of this node, depending on its type; see the table above.
XDocument | getOwnerDocument ()
| The Document object associated with this node.
XNode | getParentNode ()
| The parent of this node.
string | getPrefix ()
| The namespace prefix of this node, or null if it is unspecified.
XNode | getPreviousSibling ()
| The node immediately preceding this node.
boolean | hasAttributes ()
| Returns whether this node (if it is an element) has any attributes.
boolean | hasChildNodes ()
| Returns whether this node has any children.
XNode | insertBefore ([in] XNode newChild, [in] XNode refChild) raises (DOMException)
| Inserts the node newChild before the existing child node refChild.
boolean | isSupported ([in] string feature, [in] string ver)
| Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
void | normalize ()
| Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
XNode | removeChild ([in] XNode oldChild) raises (DOMException)
| Removes the child node indicated by oldChild from the list of children, and returns it.
XNode | replaceChild ([in] XNode newChild, [in] XNode oldChild) raises (DOMException)
| Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
void | setNodeValue ([in] string nodeValue) raises (DOMException)
| The value of this node, depending on its type; see the table above.
void | setPrefix ([in] string prefix) raises (DOMException)
| The namespace prefix of this node, or null if it is unspecified.
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object.
void | acquire ()
| increases the reference counter by one.
void | release ()
| decreases the reference counter by one.

## Detailed Description

The primary dom datatype.

The Node interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing the Node interface expose methods for dealing with children, not all objects implementing the Node interface may have children. For example, Text nodes may not have children, and adding children to such nodes results in a DOMException being raised.

The attributes nodeName, nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific nodeType (e.g., nodeValue for an Element or attributes for a Comment ), this returns null. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

The values of nodeName, nodeValue, and attributes vary according to the node type as follows:

Interface | nodeName | nodeValue | attributes
--- | --- | --- | ---
Attr | name of attribute | value of attribute | null
CDATASection | "#cdata-section" | content of the CDATA Section | null
Comment | "#comment" | content of the comment | null
Document | "#document" | null | null
DocumentFragment | "#document-fragment" | null | null
DocumentType | document type name | null | null
Element | tag name | null | NamedNodeMap
Entity | entity name | null | null
EntityReference | name of entity referenced | null | null
Notation | notation name | null | null
ProcessingInstruction | target | entire content excluding the target | null
Text | "#text" | content of the text node | null

See also
  Document Object Model (DOM) Level 2 Core Specification

Since
  OOo 2.0

## Member Function Documentation

## ◆ appendChild()

XNode appendChild | ( | [in] XNode | newChild | ) |
raises | ( | DOMException ) |  |  |

Adds the node newChild to the end of the list of children of this node.

Parameters

  newChild | the new child node

Exceptions

  com::sun::star::xml::dom::DOMException |

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself.

WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.

## ◆ cloneNode()

XNode cloneNode | ( | [in] boolean | deep | ) |

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

Parameters

  deep | TRUE: clone node together with any children FALSE: clone without children

Returns
  the cloned node

## ◆ getAttributes()

XNamedNodeMap getAttributes | ( |  | ) |

A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

## ◆ getChildNodes()

XNodeList getChildNodes | ( |  | ) |

A NodeList that contains all children of this node.

## ◆ getFirstChild()

XNode getFirstChild | ( |  | ) |

The first child of this node.

## ◆ getLastChild()

XNode getLastChild | ( |  | ) |

The last child of this node.

## ◆ getLocalName()

string getLocalName | ( |  | ) |

Returns the local part of the qualified name of this node.

## ◆ getNamespaceURI()

string getNamespaceURI | ( |  | ) |

The namespace URI of this node, or null if it is unspecified.

## ◆ getNextSibling()

XNode getNextSibling | ( |  | ) |

The node immediately following this node.

## ◆ getNodeName()

string getNodeName | ( |  | ) |

The name of this node, depending on its type; see the table above.

## ◆ getNodeType()

NodeType getNodeType | ( |  | ) |

A code representing the type of the underlying object, as defined above.

## ◆ getNodeValue()

string getNodeValue | ( |  | ) |
raises | ( | DOMException ) |  |  |

The value of this node, depending on its type; see the table above.

Exceptions

  com::sun::star::xml::dom::DOMException |

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

## ◆ getOwnerDocument()

XDocument getOwnerDocument | ( |  | ) |

The Document object associated with this node.

## ◆ getParentNode()

XNode getParentNode | ( |  | ) |

The parent of this node.

## ◆ getPrefix()

string getPrefix | ( |  | ) |

The namespace prefix of this node, or null if it is unspecified.

## ◆ getPreviousSibling()

XNode getPreviousSibling | ( |  | ) |

The node immediately preceding this node.

## ◆ hasAttributes()

boolean hasAttributes | ( |  | ) |

Returns whether this node (if it is an element) has any attributes.

## ◆ hasChildNodes()

boolean hasChildNodes | ( |  | ) |

Returns whether this node has any children.

## ◆ insertBefore()

XNode insertBefore | ( | [in] XNode | newChild,
|  | [in] XNode | refChild )
raises | ( | DOMException ) |  |  |

Inserts the node newChild before the existing child node refChild.

Exceptions

  DOMException |

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself.

WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.

NOT_FOUND_ERR: Raised if refChild is not a child of this node.

## ◆ isSupported()

boolean isSupported | ( | [in] string | feature,
|  | [in] string | ver )

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.

## ◆ normalize()

void normalize | ( |  | ) |

Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.

## ◆ removeChild()

XNode removeChild | ( | [in] XNode | oldChild | ) |
raises | ( | DOMException ) |  |  |

Removes the child node indicated by oldChild from the list of children, and returns it.

Exceptions

  DOMException |

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

## ◆ replaceChild()

XNode replaceChild | ( | [in] XNode | newChild,
|  | [in] XNode | oldChild )
raises | ( | DOMException ) |  |  |

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

Exceptions

  DOMException |

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors or this node itself.

WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.

NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

## ◆ setNodeValue()

void setNodeValue | ( | [in] string | nodeValue | ) |
raises | ( | DOMException ) |  |  |

The value of this node, depending on its type; see the table above.

Exceptions

  DOMException |

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

## ◆ setPrefix()

void setPrefix | ( | [in] string | prefix | ) |
raises | ( | DOMException ) |  |  |

The namespace prefix of this node, or null if it is unspecified.

Exceptions

  DOMException |

INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character, per the XML 1.0 specification .

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NAMESPACE_ERR: Raised if the specified prefix is malformed per the Namespaces in XML specification, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from " http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" .

The documentation for this interface was generated from the following file:

- com/sun/star/xml/dom/XNode.idl