001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.tax.dom;
043:
044: import org.w3c.dom.*;
045: import org.netbeans.tax.*;
046:
047: /**
048: *
049: * @author Petr Kuzel
050: */
051: abstract class NodeImpl implements Node {
052:
053: /** Creates a new instance of AttrImpl */
054: NodeImpl() {
055: }
056:
057: /** Adds the node <code>newChild</code> to the end of the list of children
058: * of this node. If the <code>newChild</code> is already in the tree, it
059: * is first removed.
060: * @param newChild The node to add.If it is a
061: * <code>DocumentFragment</code> object, the entire contents of the
062: * document fragment are moved into the child list of this node
063: * @return The node added.
064: * @exception DOMException
065: * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
066: * allow children of the type of the <code>newChild</code> node, or if
067: * the node to append is one of this node's ancestors or this node
068: * itself.
069: * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
070: * from a different document than the one that created this node.
071: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
072: * if the previous parent of the node being inserted is readonly.
073: *
074: */
075: public Node appendChild(Node newChild) throws DOMException {
076: throw new ROException();
077: }
078:
079: /** Returns a duplicate of this node, i.e., serves as a generic copy
080: * constructor for nodes. The duplicate node has no parent; (
081: * <code>parentNode</code> is <code>null</code>.).
082: * <br>Cloning an <code>Element</code> copies all attributes and their
083: * values, including those generated by the XML processor to represent
084: * defaulted attributes, but this method does not copy any text it
085: * contains unless it is a deep clone, since the text is contained in a
086: * child <code>Text</code> node. Cloning an <code>Attribute</code>
087: * directly, as opposed to be cloned as part of an <code>Element</code>
088: * cloning operation, returns a specified attribute (
089: * <code>specified</code> is <code>true</code>). Cloning any other type
090: * of node simply returns a copy of this node.
091: * <br>Note that cloning an immutable subtree results in a mutable copy,
092: * but the children of an <code>EntityReference</code> clone are readonly
093: * . In addition, clones of unspecified <code>Attr</code> nodes are
094: * specified. And, cloning <code>Document</code>,
095: * <code>DocumentType</code>, <code>Entity</code>, and
096: * <code>Notation</code> nodes is implementation dependent.
097: * @param deep If <code>true</code>, recursively clone the subtree under
098: * the specified node; if <code>false</code>, clone only the node
099: * itself (and its attributes, if it is an <code>Element</code>).
100: * @return The duplicate node.
101: *
102: */
103: public Node cloneNode(boolean deep) {
104: return this ;
105: }
106:
107: /** A <code>NamedNodeMap</code> containing the attributes of this node (if
108: * it is an <code>Element</code>) or <code>null</code> otherwise.
109: *
110: */
111: public NamedNodeMap getAttributes() {
112: return null;
113: }
114:
115: /** A <code>NodeList</code> that contains all children of this node. If
116: * there are no children, this is a <code>NodeList</code> containing no
117: * nodes.
118: *
119: */
120: public NodeList getChildNodes() {
121: return NodeListImpl.EMPTY;
122: }
123:
124: /** The first child of this node. If there is no such node, this returns
125: * <code>null</code>.
126: *
127: */
128: public Node getFirstChild() {
129: return null;
130: }
131:
132: /** The last child of this node. If there is no such node, this returns
133: * <code>null</code>.
134: *
135: */
136: public Node getLastChild() {
137: return null;
138: }
139:
140: /** Returns the local part of the qualified name of this node.
141: * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
142: * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
143: * method, such as <code>createElement</code> from the
144: * <code>Document</code> interface, this is always <code>null</code>.
145: * @since DOM Level 2
146: *
147: */
148: public String getLocalName() {
149: return null;
150: }
151:
152: /** The namespace URI of this node, or <code>null</code> if it is
153: * unspecified.
154: * <br>This is not a computed value that is the result of a namespace
155: * lookup based on an examination of the namespace declarations in
156: * scope. It is merely the namespace URI given at creation time.
157: * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
158: * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
159: * method, such as <code>createElement</code> from the
160: * <code>Document</code> interface, this is always <code>null</code>.Per
161: * the Namespaces in XML Specification an attribute does not inherit
162: * its namespace from the element it is attached to. If an attribute is
163: * not explicitly given a namespace, it simply has no namespace.
164: * @since DOM Level 2
165: *
166: */
167: public String getNamespaceURI() {
168: return null;
169: }
170:
171: /** The node immediately following this node. If there is no such node,
172: * this returns <code>null</code>.
173: *
174: */
175: public Node getNextSibling() {
176: return null;
177: }
178:
179: /** The name of this node, depending on its type; see the table above.
180: *
181: */
182: public abstract String getNodeName();
183:
184: /** A code representing the type of the underlying object, as defined above.
185: *
186: */
187: public abstract short getNodeType();
188:
189: /** The value of this node, depending on its type; see the table above.
190: * When it is defined to be <code>null</code>, setting it has no effect.
191: * @exception DOMException
192: * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
193: * @exception DOMException
194: * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
195: * fit in a <code>DOMString</code> variable on the implementation
196: * platform.
197: *
198: */
199: public abstract String getNodeValue() throws DOMException;
200:
201: /** The <code>Document</code> object associated with this node. This is
202: * also the <code>Document</code> object used to create new nodes. When
203: * this node is a <code>Document</code> or a <code>DocumentType</code>
204: * which is not used with any <code>Document</code> yet, this is
205: * <code>null</code>.
206: * @version DOM Level 2
207: *
208: */
209: public Document getOwnerDocument() {
210: throw new UOException();
211: }
212:
213: /** The parent of this node. All nodes, except <code>Attr</code>,
214: * <code>Document</code>, <code>DocumentFragment</code>,
215: * <code>Entity</code>, and <code>Notation</code> may have a parent.
216: * However, if a node has just been created and not yet added to the
217: * tree, or if it has been removed from the tree, this is
218: * <code>null</code>.
219: *
220: */
221: public abstract Node getParentNode();
222:
223: /** The namespace prefix of this node, or <code>null</code> if it is
224: * unspecified.
225: * <br>Note that setting this attribute, when permitted, changes the
226: * <code>nodeName</code> attribute, which holds the qualified name, as
227: * well as the <code>tagName</code> and <code>name</code> attributes of
228: * the <code>Element</code> and <code>Attr</code> interfaces, when
229: * applicable.
230: * <br>Note also that changing the prefix of an attribute that is known to
231: * have a default value, does not make a new attribute with the default
232: * value and the original prefix appear, since the
233: * <code>namespaceURI</code> and <code>localName</code> do not change.
234: * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
235: * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
236: * method, such as <code>createElement</code> from the
237: * <code>Document</code> interface, this is always <code>null</code>.
238: * @exception DOMException
239: * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
240: * illegal character, per the XML 1.0 specification .
241: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
242: * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is
243: * malformed per the Namespaces in XML specification, if the
244: * <code>namespaceURI</code> of this node is <code>null</code>, if the
245: * specified prefix is "xml" and the <code>namespaceURI</code> of this
246: * node is different from "http://www.w3.org/XML/1998/namespace", if
247: * this node is an attribute and the specified prefix is "xmlns" and
248: * the <code>namespaceURI</code> of this node is different from "
249: * http://www.w3.org/2000/xmlns/", or if this node is an attribute and
250: * the <code>qualifiedName</code> of this node is "xmlns" .
251: * @since DOM Level 2
252: *
253: */
254: public String getPrefix() {
255: return null;
256: }
257:
258: /** The node immediately preceding this node. If there is no such node,
259: * this returns <code>null</code>.
260: *
261: */
262: public Node getPreviousSibling() {
263: return null;
264: }
265:
266: /** Returns whether this node (if it is an element) has any attributes.
267: * @return <code>true</code> if this node has any attributes,
268: * <code>false</code> otherwise.
269: * @since DOM Level 2
270: *
271: */
272: public boolean hasAttributes() {
273: return false;
274: }
275:
276: /** Returns whether this node has any children.
277: * @return <code>true</code> if this node has any children,
278: * <code>false</code> otherwise.
279: *
280: */
281: public boolean hasChildNodes() {
282: return false;
283: }
284:
285: /** Inserts the node <code>newChild</code> before the existing child node
286: * <code>refChild</code>. If <code>refChild</code> is <code>null</code>,
287: * insert <code>newChild</code> at the end of the list of children.
288: * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
289: * all of its children are inserted, in the same order, before
290: * <code>refChild</code>. If the <code>newChild</code> is already in the
291: * tree, it is first removed.
292: * @param newChild The node to insert.
293: * @param refChild The reference node, i.e., the node before which the
294: * new node must be inserted.
295: * @return The node being inserted.
296: * @exception DOMException
297: * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
298: * allow children of the type of the <code>newChild</code> node, or if
299: * the node to insert is one of this node's ancestors or this node
300: * itself.
301: * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
302: * from a different document than the one that created this node.
303: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
304: * if the parent of the node being inserted is readonly.
305: * <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of
306: * this node.
307: *
308: */
309: public Node insertBefore(Node newChild, Node refChild)
310: throws DOMException {
311: throw new ROException();
312: }
313:
314: /** Tests whether the DOM implementation implements a specific feature and
315: * that feature is supported by this node.
316: * @param feature The name of the feature to test. This is the same name
317: * which can be passed to the method <code>hasFeature</code> on
318: * <code>DOMImplementation</code>.
319: * @param version This is the version number of the feature to test. In
320: * Level 2, version 1, this is the string "2.0". If the version is not
321: * specified, supporting any version of the feature will cause the
322: * method to return <code>true</code>.
323: * @return Returns <code>true</code> if the specified feature is
324: * supported on this node, <code>false</code> otherwise.
325: * @since DOM Level 2
326: *
327: */
328: public boolean isSupported(String feature, String version) {
329: return "1.0".equals(version);
330: }
331:
332: /** Puts all <code>Text</code> nodes in the full depth of the sub-tree
333: * underneath this <code>Node</code>, including attribute nodes, into a
334: * "normal" form where only structure (e.g., elements, comments,
335: * processing instructions, CDATA sections, and entity references)
336: * separates <code>Text</code> nodes, i.e., there are neither adjacent
337: * <code>Text</code> nodes nor empty <code>Text</code> nodes. This can
338: * be used to ensure that the DOM view of a document is the same as if
339: * it were saved and re-loaded, and is useful when operations (such as
340: * XPointer lookups) that depend on a particular document tree
341: * structure are to be used.In cases where the document contains
342: * <code>CDATASections</code>, the normalize operation alone may not be
343: * sufficient, since XPointers do not differentiate between
344: * <code>Text</code> nodes and <code>CDATASection</code> nodes.
345: * @version DOM Level 2
346: *
347: */
348: public void normalize() {
349: throw new ROException();
350: }
351:
352: /** Removes the child node indicated by <code>oldChild</code> from the list
353: * of children, and returns it.
354: * @param oldChild The node being removed.
355: * @return The node removed.
356: * @exception DOMException
357: * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
358: * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
359: * this node.
360: *
361: */
362: public Node removeChild(Node oldChild) throws DOMException {
363: throw new ROException();
364: }
365:
366: /** Replaces the child node <code>oldChild</code> with <code>newChild</code>
367: * in the list of children, and returns the <code>oldChild</code> node.
368: * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
369: * <code>oldChild</code> is replaced by all of the
370: * <code>DocumentFragment</code> children, which are inserted in the
371: * same order. If the <code>newChild</code> is already in the tree, it
372: * is first removed.
373: * @param newChild The new node to put in the child list.
374: * @param oldChild The node being replaced in the list.
375: * @return The node replaced.
376: * @exception DOMException
377: * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
378: * allow children of the type of the <code>newChild</code> node, or if
379: * the node to put in is one of this node's ancestors or this node
380: * itself.
381: * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
382: * from a different document than the one that created this node.
383: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of
384: * the new node is readonly.
385: * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
386: * this node.
387: *
388: */
389: public Node replaceChild(Node newChild, Node oldChild)
390: throws DOMException {
391: throw new ROException();
392: }
393:
394: /** The value of this node, depending on its type; see the table above.
395: * When it is defined to be <code>null</code>, setting it has no effect.
396: * @exception DOMException
397: * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
398: * @exception DOMException
399: * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
400: * fit in a <code>DOMString</code> variable on the implementation
401: * platform.
402: *
403: */
404: public void setNodeValue(String nodeValue) throws DOMException {
405: throw new ROException();
406: }
407:
408: /** The namespace prefix of this node, or <code>null</code> if it is
409: * unspecified.
410: * <br>Note that setting this attribute, when permitted, changes the
411: * <code>nodeName</code> attribute, which holds the qualified name, as
412: * well as the <code>tagName</code> and <code>name</code> attributes of
413: * the <code>Element</code> and <code>Attr</code> interfaces, when
414: * applicable.
415: * <br>Note also that changing the prefix of an attribute that is known to
416: * have a default value, does not make a new attribute with the default
417: * value and the original prefix appear, since the
418: * <code>namespaceURI</code> and <code>localName</code> do not change.
419: * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
420: * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
421: * method, such as <code>createElement</code> from the
422: * <code>Document</code> interface, this is always <code>null</code>.
423: * @exception DOMException
424: * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
425: * illegal character, per the XML 1.0 specification .
426: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
427: * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is
428: * malformed per the Namespaces in XML specification, if the
429: * <code>namespaceURI</code> of this node is <code>null</code>, if the
430: * specified prefix is "xml" and the <code>namespaceURI</code> of this
431: * node is different from "http://www.w3.org/XML/1998/namespace", if
432: * this node is an attribute and the specified prefix is "xmlns" and
433: * the <code>namespaceURI</code> of this node is different from "
434: * http://www.w3.org/2000/xmlns/", or if this node is an attribute and
435: * the <code>qualifiedName</code> of this node is "xmlns" .
436: * @since DOM Level 2
437: *
438: */
439: public void setPrefix(String prefix) throws DOMException {
440: throw new ROException();
441: }
442:
443: //
444: // Implementation of DOM Level 3 methods
445: //
446:
447: public short compareDocumentPosition(Node a) {
448: throw new UOException();
449: }
450:
451: public String getBaseURI() {
452: throw new UOException();
453: }
454:
455: public Object getFeature(String a, String b) {
456: throw new UOException();
457: }
458:
459: public String getTextContent() {
460: throw new UOException();
461: }
462:
463: public Object getUserData(String a) {
464: throw new UOException();
465: }
466:
467: public boolean isDefaultNamespace(String a) {
468: throw new UOException();
469: }
470:
471: public boolean isEqualNode(Node a) {
472: throw new UOException();
473: }
474:
475: public boolean isSameNode(Node a) {
476: throw new UOException();
477: }
478:
479: public String lookupNamespaceURI(String a) {
480: throw new UOException();
481: }
482:
483: public String lookupPrefix(String a) {
484: throw new UOException();
485: }
486:
487: public void setTextContent(String a) {
488: throw new UOException();
489: }
490:
491: public Object setUserData(String a, Object b, UserDataHandler c) {
492: throw new UOException();
493: }
494:
495: // Implementation of DOM Level 3 methods for Element
496: public TypeInfo getSchemaTypeInfo() {
497: throw new UOException();
498: }
499:
500: public void setIdAttribute(String a, boolean b) {
501: throw new UOException();
502: }
503:
504: public void setIdAttributeNS(String a, String b, boolean c) {
505: throw new UOException();
506: }
507:
508: public void setIdAttributeNode(Attr a, boolean b) {
509: throw new UOException();
510: }
511:
512: // Implementation of DOM Level 3 methods for Attr
513:
514: public boolean isId() {
515: throw new UOException();
516: }
517:
518: // Implementation of DOM Level 3 methods for Text
519: public Text replaceWholeText(String a) {
520: throw new UOException();
521: }
522:
523: public String getWholeText() {
524: throw new UOException();
525: }
526:
527: public boolean isElementContentWhitespace() {
528: throw new UOException();
529: }
530:
531: }
|