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