summaryrefslogtreecommitdiff
path: root/offapi/com/sun/star/xml/dom/XNode.idl
blob: f123a2c9dce788daa16f487e8cd93d8b48a79981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: XNode.idl,v $
 * $Revision: 1.5 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef __com_sun_star_xml_dom_XNode_idl__
#define __com_sun_star_xml_dom_XNode_idl__

#ifndef __com_sun_star_uno_XInterface_idl__
#include <com/sun/star/uno/XInterface.idl>
#endif
#ifndef __com_sun_star_xml_dom_NodeType_idl__
#include <com/sun/star/xml/dom/NodeType.idl>
#endif
#ifndef __com_sun_star_xml_dom_XNodeList_idl__
#include <com/sun/star/xml/dom/XNodeList.idl>
#endif
#ifndef __com_sun_star_xml_dom_XNamedNodeMap_idl__
#include <com/sun/star/xml/dom/XNamedNodeMap.idl>
#endif


module com { module sun { module star { module xml { module dom {

interface XDocument;

/** The primary dom datatype

<p>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.</p>

<p>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.</p>

<p>The values of nodeName, nodeValue, and attributes vary according to the node type as follows:
<table align=left border=1>
<tr><th>Interface </th><th>nodeName </th><th>nodeValue </th><th>attributes</th></tr>
<tr><th>Attr                    </th><td>name of attribute  </td><td>value of attribute                 </td><td>null</td></tr>
<tr><th>CDATASection            </th><td>"#cdata-section"   </td><td>content of the CDATA Section   </td><td>null</td></tr>
<tr><th>Comment                 </th><td>"#comment"             </td><td>content of the comment          </td><td>null</td></tr>
<tr><th>Document                </th><td>"#document"        </td><td>null   </td><td>null</td></tr>
<tr><th>DocumentFragment        </th><td>"#document-fragment"</td><td>null  </td><td>null</td></tr>
<tr><th>DocumentType            </th><td>document type name     </td><td>null   </td><td>null</td></tr>
<tr><th>Element                 </th><td>tag name           </td><td>null   </td><td>NamedNodeMap</td></tr>
<tr><th>Entity                  </th><td>entity name        </td><td>null   </td><td>null</td></tr>
<tr><th>EntityReference         </th><td>name of entity referenced      </td><td>null   </td><td>null</td></tr>
<tr><th>Notation                </th><td>notation name      </td><td>null   </td><td>null</td></tr>
<tr><th>ProcessingInstruction   </th><td>target                 </td><td>entire content excluding the target    </td><td>null</td></tr>
<tr><th>Text                    </th><td>"#text"            </td><td>content of the text node   </td><td>null</td></tr>
</table></p>

@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>
@since OOo 2.0.0
*/
interface XNode : com::sun::star::uno::XInterface
{

    /**
    Adds the node newChild to the end of the list of children of this node.
    @param newChild
    the new child node
    @throws com::sun::star::xml::dom::DOMException
        <p>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.</p>
        <p>WRONG_DOCUMENT_ERR: Raised if newChild was created from a different
           document than the one that created this node.</p>
        <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if
           the previous parent of the node being inserted is readonly.</p>
    */
    XNode appendChild([in] XNode newChild) raises (DOMException);

    /**
    Returns a duplicate of this node, i.e., serves as a generic copy
    constructor for nodes.
    <p></p>
    @param deep
    <true/>: clone node together with any children<br>
    <false/>: clone without children
    @returns
    the cloned node
    */
    XNode cloneNode([in] boolean deep);

    /**
    A NamedNodeMap containing the attributes of this node (if it is an Element)
    or null otherwise.
    */
    XNamedNodeMap getAttributes();

    /**
    A NodeList that contains all children of this node.
    */
    XNodeList getChildNodes();

    /**
    The first child of this node.
    */
    XNode getFirstChild();

    /**
    The last child of this node.
    */
    XNode getLastChild();

    /**
    Returns the local part of the qualified name of this node.
    */
    string getLocalName();

    /**
    The namespace URI of this node, or null if it is unspecified.
    */
    string getNamespaceURI();

    /**
    The node immediately following this node.
    */
    XNode getNextSibling();

    /**
    The name of this node, depending on its type; see the table above.
    */
    string getNodeName();

    /**
    A code representing the type of the underlying object, as defined above.
    */
    NodeType getNodeType();

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

    @throws com::sun::star::xml::dom::DOMException
    <p>DOMSTRING_SIZE_ERR: Raised when it would return more characters
    than fit in a DOMString variable on the implementation platform.</p>
    */
    string getNodeValue() raises (DOMException);

    /**
    The Document object associated with this node.
    */
    XDocument getOwnerDocument();

    /**
    The parent of this node.
    */
    XNode getParentNode();

    /**
    The namespace prefix of this node, or null if it is unspecified.
    */
    string getPrefix();

    /**
    The node immediately preceding this node.
    */
    XNode getPreviousSibling();

    /**
    Returns whether this node (if it is an element) has any attributes.
    */
    boolean hasAttributes();

    /**
    Returns whether this node has any children.
    */
    boolean hasChildNodes();

    /**
    Inserts the node newChild before the existing child node refChild.
    @throws DOMException
    <p>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.
                   <p>WRONG_DOCUMENT_ERR: Raised if newChild was created from a different
                      document than the one that created this node.
                   <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the
                      parent of the node being inserted is readonly.
                   <p>NOT_FOUND_ERR: Raised if refChild is not a child of this node.
    */
    XNode insertBefore([in] XNode newChild, [in] XNode refChild) raises (DOMException);

    /**
    Tests whether the DOM implementation implements a specific feature and
    that feature is supported by this node.
    */
    boolean isSupported([in] string feature, [in] string ver);

    /**
    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.
    */
    void normalize();

    /**
    Removes the child node indicated by oldChild from the list of children,
    and returns it.
    @throws DOMException
    <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    <p>NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
    */
    XNode removeChild([in] XNode oldChild) raises (DOMException);

    /**
    Replaces the child node oldChild with newChild in the list of children,
    and returns the oldChild node.
    @throws DOMException
                   <p>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.
                   <p>WRONG_DOCUMENT_ERR: Raised if newChild was created from a different
                      document than the one that created this node.
                   <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the
                      new node is readonly.
                   <p>NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
    */
    XNode replaceChild([in] XNode newChild, [in] XNode oldChild) raises (DOMException);

    /**
    The value of this node, depending on its type; see the table above.
    @throws DOMException
        <p>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
        <p>DOMSTRING_SIZE_ERR: Raised when it would return more characters
                      than fit in a DOMString variable on the implementation platform.
    */
    void setNodeValue([in] string nodeValue) raises (DOMException);

    /**
    The namespace prefix of this node, or null if it is unspecified.
    @throws DOMException
        <p>INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character,
                      per the XML 1.0 specification .
                   <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
                   <p>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" .
    */
    void setPrefix([in] string prefix) raises (DOMException);

};

}; }; }; }; };

#endif