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