xref: /aoo41x/main/offapi/com/sun/star/xml/dom/XNode.idl (revision cdf0e10c)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27
28#ifndef __com_sun_star_xml_dom_XNode_idl__
29#define __com_sun_star_xml_dom_XNode_idl__
30
31#ifndef __com_sun_star_uno_XInterface_idl__
32#include <com/sun/star/uno/XInterface.idl>
33#endif
34#ifndef __com_sun_star_xml_dom_NodeType_idl__
35#include <com/sun/star/xml/dom/NodeType.idl>
36#endif
37#ifndef __com_sun_star_xml_dom_XNodeList_idl__
38#include <com/sun/star/xml/dom/XNodeList.idl>
39#endif
40#ifndef __com_sun_star_xml_dom_XNamedNodeMap_idl__
41#include <com/sun/star/xml/dom/XNamedNodeMap.idl>
42#endif
43
44
45module com { module sun { module star { module xml { module dom {
46
47interface XDocument;
48
49/** The primary dom datatype
50
51<p>The Node interface is the primary datatype for the entire Document Object Model.
52It represents a single node in the document tree. While all objects implementing
53the Node interface expose methods for dealing with children, not all objects
54#implementing the Node interface may have children. For example, Text nodes may not
55have children, and adding children to such nodes results in a DOMException being raised.</p>
56
57<p>The attributes nodeName, nodeValue and attributes are included as a mechanism to get at
58node information without casting down to the specific derived interface. In cases where
59there is no obvious mapping of these attributes for a specific nodeType (e.g., nodeValue
60for an Element or attributes for a Comment ), this returns null. Note that the specialized
61interfaces may contain additional and more convenient mechanisms to get and set the relevant
62information.</p>
63
64<p>The values of nodeName, nodeValue, and attributes vary according to the node type as follows:
65<table align=left border=1>
66<tr><th>Interface </th><th>nodeName </th><th>nodeValue </th><th>attributes</th></tr>
67<tr><th>Attr 	                </th><td>name of attribute 	</td><td>value of attribute 	            </td><td>null</td></tr>
68<tr><th>CDATASection 	        </th><td>"#cdata-section" 	</td><td>content of the CDATA Section 	</td><td>null</td></tr>
69<tr><th>Comment 	            </th><td>"#comment" 	        </td><td>content of the comment          </td><td>null</td></tr>
70<tr><th>Document 	            </th><td>"#document" 	    </td><td>null 	</td><td>null</td></tr>
71<tr><th>DocumentFragment        </th><td>"#document-fragment"</td><td>null 	</td><td>null</td></tr>
72<tr><th>DocumentType 	        </th><td>document type name 	</td><td>null 	</td><td>null</td></tr>
73<tr><th>Element 	            </th><td>tag name 	        </td><td>null 	</td><td>NamedNodeMap</td></tr>
74<tr><th>Entity 	                </th><td>entity name 	    </td><td>null 	</td><td>null</td></tr>
75<tr><th>EntityReference         </th><td>name of entity referenced 	    </td><td>null 	</td><td>null</td></tr>
76<tr><th>Notation 	            </th><td>notation name 	    </td><td>null 	</td><td>null</td></tr>
77<tr><th>ProcessingInstruction   </th><td>target 	            </td><td>entire content excluding the target 	</td><td>null</td></tr>
78<tr><th>Text 	                </th><td>"#text" 	        </td><td>content of the text node 	</td><td>null</td></tr>
79</table></p>
80
81@see <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113">Document Object Model (DOM) Level 2 Core Specification</a> </p>
82@since OOo 2.0
83*/
84interface XNode : com::sun::star::uno::XInterface
85{
86
87    /**
88    Adds the node newChild to the end of the list of children of this node.
89    @param newChild
90    the new child node
91    @throws com::sun::star::xml::dom::DOMException
92        <p>HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does
93           not allow children of the type of the newChild node, or if the
94           node to append is one of this node's ancestors or this node itself.</p>
95        <p>WRONG_DOCUMENT_ERR: Raised if newChild was created from a different
96           document than the one that created this node.</p>
97        <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if
98           the previous parent of the node being inserted is readonly.</p>
99    */
100    XNode appendChild([in] XNode newChild) raises (DOMException);
101
102    /**
103    Returns a duplicate of this node, i.e., serves as a generic copy
104    constructor for nodes.
105    <p></p>
106    @param deep
107    <true/>: clone node together with any children<br>
108    <false/>: clone without children
109    @returns
110    the cloned node
111    */
112    XNode cloneNode([in] boolean deep);
113
114    /**
115    A NamedNodeMap containing the attributes of this node (if it is an Element)
116    or null otherwise.
117    */
118    XNamedNodeMap getAttributes();
119
120    /**
121    A NodeList that contains all children of this node.
122    */
123    XNodeList getChildNodes();
124
125    /**
126    The first child of this node.
127    */
128    XNode getFirstChild();
129
130    /**
131    The last child of this node.
132    */
133    XNode getLastChild();
134
135    /**
136    Returns the local part of the qualified name of this node.
137    */
138    string getLocalName();
139
140    /**
141    The namespace URI of this node, or null if it is unspecified.
142    */
143    string getNamespaceURI();
144
145    /**
146    The node immediately following this node.
147    */
148    XNode getNextSibling();
149
150    /**
151    The name of this node, depending on its type; see the table above.
152    */
153    string getNodeName();
154
155    /**
156    A code representing the type of the underlying object, as defined above.
157    */
158    NodeType getNodeType();
159
160    /**
161    The value of this node, depending on its type; see the table above.
162
163    @throws com::sun::star::xml::dom::DOMException
164    <p>DOMSTRING_SIZE_ERR: Raised when it would return more characters
165    than fit in a DOMString variable on the implementation platform.</p>
166    */
167    string getNodeValue() raises (DOMException);
168
169    /**
170    The Document object associated with this node.
171    */
172    XDocument getOwnerDocument();
173
174    /**
175    The parent of this node.
176    */
177    XNode getParentNode();
178
179    /**
180    The namespace prefix of this node, or null if it is unspecified.
181    */
182    string getPrefix();
183
184    /**
185    The node immediately preceding this node.
186    */
187    XNode getPreviousSibling();
188
189    /**
190    Returns whether this node (if it is an element) has any attributes.
191    */
192    boolean hasAttributes();
193
194    /**
195    Returns whether this node has any children.
196    */
197    boolean hasChildNodes();
198
199    /**
200    Inserts the node newChild before the existing child node refChild.
201    @throws DOMException
202    <p>HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does
203                      not allow children of the type of the newChild node, or if the
204                      node to insert is one of this node's ancestors or this node itself.
205                   <p>WRONG_DOCUMENT_ERR: Raised if newChild was created from a different
206                      document than the one that created this node.
207                   <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the
208                      parent of the node being inserted is readonly.
209                   <p>NOT_FOUND_ERR: Raised if refChild is not a child of this node.
210    */
211    XNode insertBefore([in] XNode newChild, [in] XNode refChild) raises (DOMException);
212
213    /**
214    Tests whether the DOM implementation implements a specific feature and
215    that feature is supported by this node.
216    */
217    boolean isSupported([in] string feature, [in] string ver);
218
219    /**
220    Puts all Text nodes in the full depth of the sub-tree underneath this
221    Node, including attribute nodes, into a "normal" form where only structure
222    (e.g., elements, comments, processing instructions, CDATA sections, and
223    entity references) separates Text nodes, i.e., there are neither adjacent
224    Text nodes nor empty Text nodes.
225    */
226    void normalize();
227
228    /**
229    Removes the child node indicated by oldChild from the list of children,
230    and returns it.
231    @throws DOMException
232    <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
233    <p>NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
234    */
235    XNode removeChild([in] XNode oldChild) raises (DOMException);
236
237    /**
238    Replaces the child node oldChild with newChild in the list of children,
239    and returns the oldChild node.
240    @throws DOMException
241                   <p>HIERARCHY_REQUEST_ERR: Raised if this node is of a type that
242                      does not allow children of the type of the newChild node, or
243                      if the node to put in is one of this node's ancestors or this
244                      node itself.
245                   <p>WRONG_DOCUMENT_ERR: Raised if newChild was created from a different
246                      document than the one that created this node.
247                   <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the
248                      new node is readonly.
249                   <p>NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
250    */
251    XNode replaceChild([in] XNode newChild, [in] XNode oldChild) raises (DOMException);
252
253    /**
254    The value of this node, depending on its type; see the table above.
255    @throws DOMException
256        <p>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
257        <p>DOMSTRING_SIZE_ERR: Raised when it would return more characters
258                      than fit in a DOMString variable on the implementation platform.
259    */
260    void setNodeValue([in] string nodeValue) raises (DOMException);
261
262    /**
263    The namespace prefix of this node, or null if it is unspecified.
264    @throws DOMException
265        <p>INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character,
266                      per the XML 1.0 specification .
267                   <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
268                   <p>NAMESPACE_ERR: Raised if the specified prefix is malformed per the Namespaces
269                      in XML specification, if the namespaceURI of this node is null, if the specified
270                      prefix is "xml" and the namespaceURI of this node is different from
271                      "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the
272                      specified prefix is "xmlns" and the namespaceURI of this node is different from
273                      " http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName
274                      of this node is "xmlns" .
275    */
276    void setPrefix([in] string prefix) raises (DOMException);
277
278};
279
280}; }; }; }; };
281
282#endif
283