KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tax > dom > NodeImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20
21 package org.netbeans.tax.dom;
22
23 import org.w3c.dom.*;
24 import org.netbeans.tax.*;
25
26 /**
27  *
28  * @author Petr Kuzel
29  */

30 abstract class NodeImpl implements Node {
31
32
33     /** Creates a new instance of AttrImpl */
34     NodeImpl() {
35     }
36
37     /** Adds the node <code>newChild</code> to the end of the list of children
38      * of this node. If the <code>newChild</code> is already in the tree, it
39      * is first removed.
40      * @param newChild The node to add.If it is a
41      * <code>DocumentFragment</code> object, the entire contents of the
42      * document fragment are moved into the child list of this node
43      * @return The node added.
44      * @exception DOMException
45      * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
46      * allow children of the type of the <code>newChild</code> node, or if
47      * the node to append is one of this node's ancestors or this node
48      * itself.
49      * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
50      * from a different document than the one that created this node.
51      * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
52      * if the previous parent of the node being inserted is readonly.
53      *
54      */

55     public Node appendChild(Node newChild) throws DOMException {
56         throw new ROException();
57     }
58     
59     /** Returns a duplicate of this node, i.e., serves as a generic copy
60      * constructor for nodes. The duplicate node has no parent; (
61      * <code>parentNode</code> is <code>null</code>.).
62      * <br>Cloning an <code>Element</code> copies all attributes and their
63      * values, including those generated by the XML processor to represent
64      * defaulted attributes, but this method does not copy any text it
65      * contains unless it is a deep clone, since the text is contained in a
66      * child <code>Text</code> node. Cloning an <code>Attribute</code>
67      * directly, as opposed to be cloned as part of an <code>Element</code>
68      * cloning operation, returns a specified attribute (
69      * <code>specified</code> is <code>true</code>). Cloning any other type
70      * of node simply returns a copy of this node.
71      * <br>Note that cloning an immutable subtree results in a mutable copy,
72      * but the children of an <code>EntityReference</code> clone are readonly
73      * . In addition, clones of unspecified <code>Attr</code> nodes are
74      * specified. And, cloning <code>Document</code>,
75      * <code>DocumentType</code>, <code>Entity</code>, and
76      * <code>Notation</code> nodes is implementation dependent.
77      * @param deep If <code>true</code>, recursively clone the subtree under
78      * the specified node; if <code>false</code>, clone only the node
79      * itself (and its attributes, if it is an <code>Element</code>).
80      * @return The duplicate node.
81      *
82      */

83     public Node cloneNode(boolean deep) {
84         return this;
85     }
86     
87     /** A <code>NamedNodeMap</code> containing the attributes of this node (if
88      * it is an <code>Element</code>) or <code>null</code> otherwise.
89      *
90      */

91     public NamedNodeMap getAttributes() {
92         return null;
93     }
94     
95     /** A <code>NodeList</code> that contains all children of this node. If
96      * there are no children, this is a <code>NodeList</code> containing no
97      * nodes.
98      *
99      */

100     public NodeList getChildNodes() {
101         return NodeListImpl.EMPTY;
102     }
103     
104     /** The first child of this node. If there is no such node, this returns
105      * <code>null</code>.
106      *
107      */

108     public Node getFirstChild() {
109         return null;
110     }
111     
112     /** The last child of this node. If there is no such node, this returns
113      * <code>null</code>.
114      *
115      */

116     public Node getLastChild() {
117         return null;
118     }
119     
120     /** Returns the local part of the qualified name of this node.
121      * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
122      * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
123      * method, such as <code>createElement</code> from the
124      * <code>Document</code> interface, this is always <code>null</code>.
125      * @since DOM Level 2
126      *
127      */

128     public String JavaDoc getLocalName() {
129         return null;
130     }
131     
132     /** The namespace URI of this node, or <code>null</code> if it is
133      * unspecified.
134      * <br>This is not a computed value that is the result of a namespace
135      * lookup based on an examination of the namespace declarations in
136      * scope. It is merely the namespace URI given at creation time.
137      * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
138      * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
139      * method, such as <code>createElement</code> from the
140      * <code>Document</code> interface, this is always <code>null</code>.Per
141      * the Namespaces in XML Specification an attribute does not inherit
142      * its namespace from the element it is attached to. If an attribute is
143      * not explicitly given a namespace, it simply has no namespace.
144      * @since DOM Level 2
145      *
146      */

147     public String JavaDoc getNamespaceURI() {
148         return null;
149     }
150     
151     /** The node immediately following this node. If there is no such node,
152      * this returns <code>null</code>.
153      *
154      */

155     public Node getNextSibling() {
156         return null;
157     }
158     
159     /** The name of this node, depending on its type; see the table above.
160      *
161      */

162     public abstract String JavaDoc getNodeName();
163     
164     /** A code representing the type of the underlying object, as defined above.
165      *
166      */

167     public abstract short getNodeType();
168     
169     /** The value of this node, depending on its type; see the table above.
170      * When it is defined to be <code>null</code>, setting it has no effect.
171      * @exception DOMException
172      * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
173      * @exception DOMException
174      * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
175      * fit in a <code>DOMString</code> variable on the implementation
176      * platform.
177      *
178      */

179     public abstract String JavaDoc getNodeValue() throws DOMException;
180     
181     /** The <code>Document</code> object associated with this node. This is
182      * also the <code>Document</code> object used to create new nodes. When
183      * this node is a <code>Document</code> or a <code>DocumentType</code>
184      * which is not used with any <code>Document</code> yet, this is
185      * <code>null</code>.
186      * @version DOM Level 2
187      *
188      */

189     public Document getOwnerDocument() {
190         throw new UOException();
191     }
192     
193     /** The parent of this node. All nodes, except <code>Attr</code>,
194      * <code>Document</code>, <code>DocumentFragment</code>,
195      * <code>Entity</code>, and <code>Notation</code> may have a parent.
196      * However, if a node has just been created and not yet added to the
197      * tree, or if it has been removed from the tree, this is
198      * <code>null</code>.
199      *
200      */

201     public abstract Node getParentNode();
202     
203     /** The namespace prefix of this node, or <code>null</code> if it is
204      * unspecified.
205      * <br>Note that setting this attribute, when permitted, changes the
206      * <code>nodeName</code> attribute, which holds the qualified name, as
207      * well as the <code>tagName</code> and <code>name</code> attributes of
208      * the <code>Element</code> and <code>Attr</code> interfaces, when
209      * applicable.
210      * <br>Note also that changing the prefix of an attribute that is known to
211      * have a default value, does not make a new attribute with the default
212      * value and the original prefix appear, since the
213      * <code>namespaceURI</code> and <code>localName</code> do not change.
214      * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
215      * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
216      * method, such as <code>createElement</code> from the
217      * <code>Document</code> interface, this is always <code>null</code>.
218      * @exception DOMException
219      * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
220      * illegal character, per the XML 1.0 specification .
221      * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
222      * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is
223      * malformed per the Namespaces in XML specification, if the
224      * <code>namespaceURI</code> of this node is <code>null</code>, if the
225      * specified prefix is "xml" and the <code>namespaceURI</code> of this
226      * node is different from "http://www.w3.org/XML/1998/namespace", if
227      * this node is an attribute and the specified prefix is "xmlns" and
228      * the <code>namespaceURI</code> of this node is different from "
229      * http://www.w3.org/2000/xmlns/", or if this node is an attribute and
230      * the <code>qualifiedName</code> of this node is "xmlns" .
231      * @since DOM Level 2
232      *
233      */

234     public String JavaDoc getPrefix() {
235         return null;
236     }
237     
238     /** The node immediately preceding this node. If there is no such node,
239      * this returns <code>null</code>.
240      *
241      */

242     public Node getPreviousSibling() {
243         return null;
244     }
245     
246     /** Returns whether this node (if it is an element) has any attributes.
247      * @return <code>true</code> if this node has any attributes,
248      * <code>false</code> otherwise.
249      * @since DOM Level 2
250      *
251      */

252     public boolean hasAttributes() {
253         return false;
254     }
255     
256     /** Returns whether this node has any children.
257      * @return <code>true</code> if this node has any children,
258      * <code>false</code> otherwise.
259      *
260      */

261     public boolean hasChildNodes() {
262         return false;
263     }
264     
265     /** Inserts the node <code>newChild</code> before the existing child node
266      * <code>refChild</code>. If <code>refChild</code> is <code>null</code>,
267      * insert <code>newChild</code> at the end of the list of children.
268      * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
269      * all of its children are inserted, in the same order, before
270      * <code>refChild</code>. If the <code>newChild</code> is already in the
271      * tree, it is first removed.
272      * @param newChild The node to insert.
273      * @param refChild The reference node, i.e., the node before which the
274      * new node must be inserted.
275      * @return The node being inserted.
276      * @exception DOMException
277      * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
278      * allow children of the type of the <code>newChild</code> node, or if
279      * the node to insert is one of this node's ancestors or this node
280      * itself.
281      * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
282      * from a different document than the one that created this node.
283      * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
284      * if the parent of the node being inserted is readonly.
285      * <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of
286      * this node.
287      *
288      */

289     public Node insertBefore(Node newChild, Node refChild) throws DOMException {
290         throw new ROException();
291     }
292     
293     /** Tests whether the DOM implementation implements a specific feature and
294      * that feature is supported by this node.
295      * @param feature The name of the feature to test. This is the same name
296      * which can be passed to the method <code>hasFeature</code> on
297      * <code>DOMImplementation</code>.
298      * @param version This is the version number of the feature to test. In
299      * Level 2, version 1, this is the string "2.0". If the version is not
300      * specified, supporting any version of the feature will cause the
301      * method to return <code>true</code>.
302      * @return Returns <code>true</code> if the specified feature is
303      * supported on this node, <code>false</code> otherwise.
304      * @since DOM Level 2
305      *
306      */

307     public boolean isSupported(String JavaDoc feature, String JavaDoc version) {
308         return "1.0".equals(version);
309     }
310     
311     /** Puts all <code>Text</code> nodes in the full depth of the sub-tree
312      * underneath this <code>Node</code>, including attribute nodes, into a
313      * "normal" form where only structure (e.g., elements, comments,
314      * processing instructions, CDATA sections, and entity references)
315      * separates <code>Text</code> nodes, i.e., there are neither adjacent
316      * <code>Text</code> nodes nor empty <code>Text</code> nodes. This can
317      * be used to ensure that the DOM view of a document is the same as if
318      * it were saved and re-loaded, and is useful when operations (such as
319      * XPointer lookups) that depend on a particular document tree
320      * structure are to be used.In cases where the document contains
321      * <code>CDATASections</code>, the normalize operation alone may not be
322      * sufficient, since XPointers do not differentiate between
323      * <code>Text</code> nodes and <code>CDATASection</code> nodes.
324      * @version DOM Level 2
325      *
326      */

327     public void normalize() {
328         throw new ROException();
329     }
330     
331     /** Removes the child node indicated by <code>oldChild</code> from the list
332      * of children, and returns it.
333      * @param oldChild The node being removed.
334      * @return The node removed.
335      * @exception DOMException
336      * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
337      * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
338      * this node.
339      *
340      */

341     public Node removeChild(Node oldChild) throws DOMException {
342         throw new ROException();
343     }
344     
345     /** Replaces the child node <code>oldChild</code> with <code>newChild</code>
346      * in the list of children, and returns the <code>oldChild</code> node.
347      * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
348      * <code>oldChild</code> is replaced by all of the
349      * <code>DocumentFragment</code> children, which are inserted in the
350      * same order. If the <code>newChild</code> is already in the tree, it
351      * is first removed.
352      * @param newChild The new node to put in the child list.
353      * @param oldChild The node being replaced in the list.
354      * @return The node replaced.
355      * @exception DOMException
356      * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
357      * allow children of the type of the <code>newChild</code> node, or if
358      * the node to put in is one of this node's ancestors or this node
359      * itself.
360      * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
361      * from a different document than the one that created this node.
362      * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of
363      * the new node is readonly.
364      * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
365      * this node.
366      *
367      */

368     public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
369         throw new ROException();
370     }
371     
372     /** The value of this node, depending on its type; see the table above.
373      * When it is defined to be <code>null</code>, setting it has no effect.
374      * @exception DOMException
375      * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
376      * @exception DOMException
377      * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
378      * fit in a <code>DOMString</code> variable on the implementation
379      * platform.
380      *
381      */

382     public void setNodeValue(String JavaDoc nodeValue) throws DOMException {
383         throw new ROException();
384     }
385     
386     /** The namespace prefix of this node, or <code>null</code> if it is
387      * unspecified.
388      * <br>Note that setting this attribute, when permitted, changes the
389      * <code>nodeName</code> attribute, which holds the qualified name, as
390      * well as the <code>tagName</code> and <code>name</code> attributes of
391      * the <code>Element</code> and <code>Attr</code> interfaces, when
392      * applicable.
393      * <br>Note also that changing the prefix of an attribute that is known to
394      * have a default value, does not make a new attribute with the default
395      * value and the original prefix appear, since the
396      * <code>namespaceURI</code> and <code>localName</code> do not change.
397      * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
398      * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
399      * method, such as <code>createElement</code> from the
400      * <code>Document</code> interface, this is always <code>null</code>.
401      * @exception DOMException
402      * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
403      * illegal character, per the XML 1.0 specification .
404      * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
405      * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is
406      * malformed per the Namespaces in XML specification, if the
407      * <code>namespaceURI</code> of this node is <code>null</code>, if the
408      * specified prefix is "xml" and the <code>namespaceURI</code> of this
409      * node is different from "http://www.w3.org/XML/1998/namespace", if
410      * this node is an attribute and the specified prefix is "xmlns" and
411      * the <code>namespaceURI</code> of this node is different from "
412      * http://www.w3.org/2000/xmlns/", or if this node is an attribute and
413      * the <code>qualifiedName</code> of this node is "xmlns" .
414      * @since DOM Level 2
415      *
416      */

417     public void setPrefix(String JavaDoc prefix) throws DOMException {
418         throw new ROException();
419     }
420
421     //
422
// Implementation of DOM Level 3 methods
423
//
424

425     public short compareDocumentPosition (Node a) {
426         throw new UOException();
427     }
428     
429     public String JavaDoc getBaseURI() {
430         throw new UOException();
431     }
432     public Object JavaDoc getFeature(String JavaDoc a, String JavaDoc b) {
433         throw new UOException();
434     }
435     public String JavaDoc getTextContent () {
436         throw new UOException();
437     }
438     public Object JavaDoc getUserData(String JavaDoc a) {
439         throw new UOException();
440     }
441     public boolean isDefaultNamespace (String JavaDoc a) {
442         throw new UOException();
443     }
444     public boolean isEqualNode(Node a) {
445         throw new UOException();
446     }
447     public boolean isSameNode(Node a) {
448         throw new UOException();
449     }
450     public String JavaDoc lookupNamespaceURI(String JavaDoc a) {
451         throw new UOException();
452     }
453     public String JavaDoc lookupPrefix(String JavaDoc a) {
454         throw new UOException();
455     }
456     public void setTextContent(String JavaDoc a) {
457         throw new UOException();
458     }
459     public Object JavaDoc setUserData(String JavaDoc a, Object JavaDoc b, UserDataHandler c) {
460         throw new UOException();
461     }
462     
463     // Implementation of DOM Level 3 methods for Element
464
public TypeInfo getSchemaTypeInfo() {
465         throw new UOException ();
466     }
467     public void setIdAttribute(String JavaDoc a, boolean b) {
468         throw new UOException ();
469     }
470     public void setIdAttributeNS(String JavaDoc a, String JavaDoc b, boolean c) {
471         throw new UOException ();
472     }
473     public void setIdAttributeNode(Attr a, boolean b) {
474         throw new UOException ();
475     }
476     // Implementation of DOM Level 3 methods for Attr
477

478     public boolean isId () {
479         throw new UOException ();
480     }
481     // Implementation of DOM Level 3 methods for Text
482
public Text replaceWholeText (String JavaDoc a) {
483         throw new UOException ();
484     }
485     public String JavaDoc getWholeText() {
486         throw new UOException ();
487     }
488     public boolean isElementContentWhitespace() {
489         throw new UOException ();
490     }
491     
492 }
493
Popular Tags