KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > dtm > ref > dom2dtm > DOM2DTMdefaultNamespaceDeclarationNode


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: DOM2DTMdefaultNamespaceDeclarationNode.java,v
18  */

19 package com.sun.org.apache.xml.internal.dtm.ref.dom2dtm;
20
21 import com.sun.org.apache.xml.internal.dtm.DTMException;
22
23 import org.w3c.dom.Attr JavaDoc;
24 import org.w3c.dom.Document JavaDoc;
25 import org.w3c.dom.Element JavaDoc;
26 import org.w3c.dom.NamedNodeMap JavaDoc;
27 import org.w3c.dom.Node JavaDoc;
28 import org.w3c.dom.NodeList JavaDoc;
29 import org.w3c.dom.TypeInfo JavaDoc;
30 import org.w3c.dom.UserDataHandler JavaDoc;
31 import org.w3c.dom.DOMException JavaDoc;
32
33 /** This is a kluge to let us shove a declaration for xml: into the
34  * DOM2DTM model. Basically, it creates a proxy node in DOM space to
35  * carry the additional information. This is _NOT_ a full DOM
36  * implementation, and shouldn't be one since it sits alongside the
37  * DOM rather than becoming part of the DOM model.
38  *
39  * (This used to be an internal class within DOM2DTM. Moved out because
40  * I need to perform an instanceof operation on it to support a temporary
41  * workaround in DTMManagerDefault.)
42  *
43  * %REVIEW% What if the DOM2DTM was built around a DocumentFragment and
44  * there isn't a single root element? I think this fails that case...
45  *
46  * %REVIEW% An alternative solution would be to create the node _only_
47  * in DTM space, but given how DOM2DTM is currently written I think
48  * this is simplest.
49  * */

50 public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr JavaDoc,TypeInfo JavaDoc
51 {
52   final String JavaDoc NOT_SUPPORTED_ERR="Unsupported operation on pseudonode";
53   
54   Element JavaDoc pseudoparent;
55   String JavaDoc prefix,uri,nodename;
56   int handle;
57   DOM2DTMdefaultNamespaceDeclarationNode(Element JavaDoc pseudoparent,String JavaDoc prefix,String JavaDoc uri,int handle)
58   {
59     this.pseudoparent=pseudoparent;
60     this.prefix=prefix;
61     this.uri=uri;
62     this.handle=handle;
63     this.nodename="xmlns:"+prefix;
64   }
65   public String JavaDoc getNodeName() {return nodename;}
66   public String JavaDoc getName() {return nodename;}
67   public String JavaDoc getNamespaceURI() {return "http://www.w3.org/2000/xmlns/";}
68   public String JavaDoc getPrefix() {return prefix;}
69   public String JavaDoc getLocalName() {return prefix;}
70   public String JavaDoc getNodeValue() {return uri;}
71   public String JavaDoc getValue() {return uri;}
72   public Element JavaDoc getOwnerElement() {return pseudoparent;}
73   
74   public boolean isSupported(String JavaDoc feature, String JavaDoc version) {return false;}
75   public boolean hasChildNodes() {return false;}
76   public boolean hasAttributes() {return false;}
77   public Node JavaDoc getParentNode() {return null;}
78   public Node JavaDoc getFirstChild() {return null;}
79   public Node JavaDoc getLastChild() {return null;}
80   public Node JavaDoc getPreviousSibling() {return null;}
81   public Node JavaDoc getNextSibling() {return null;}
82   public boolean getSpecified() {return false;}
83   public void normalize() {return;}
84   public NodeList JavaDoc getChildNodes() {return null;}
85   public NamedNodeMap JavaDoc getAttributes() {return null;}
86   public short getNodeType() {return Node.ATTRIBUTE_NODE;}
87   public void setNodeValue(String JavaDoc value) {throw new DTMException(NOT_SUPPORTED_ERR);}
88   public void setValue(String JavaDoc value) {throw new DTMException(NOT_SUPPORTED_ERR);}
89   public void setPrefix(String JavaDoc value) {throw new DTMException(NOT_SUPPORTED_ERR);}
90   public Node JavaDoc insertBefore(Node JavaDoc a, Node JavaDoc b) {throw new DTMException(NOT_SUPPORTED_ERR);}
91   public Node JavaDoc replaceChild(Node JavaDoc a, Node JavaDoc b) {throw new DTMException(NOT_SUPPORTED_ERR);}
92   public Node JavaDoc appendChild(Node JavaDoc a) {throw new DTMException(NOT_SUPPORTED_ERR);}
93   public Node JavaDoc removeChild(Node JavaDoc a) {throw new DTMException(NOT_SUPPORTED_ERR);}
94   public Document JavaDoc getOwnerDocument() {return pseudoparent.getOwnerDocument();}
95   public Node JavaDoc cloneNode(boolean deep) {throw new DTMException(NOT_SUPPORTED_ERR);}
96     
97     /** Non-DOM method, part of the temporary kluge
98      * %REVIEW% This would be a pruning problem, but since it will always be
99      * added to the root element and we prune on elements, we shouldn't have
100      * to worry.
101      */

102     public int getHandleOfNode()
103     {
104         return handle;
105     }
106 //RAMESH: PENDING=> Add proper implementation for the below DOM L3 additions
107

108     /**
109      * @see org.w3c.dom.TypeInfo#getTypeName()
110      */

111     public String JavaDoc getTypeName() {return null; }
112      /**
113      * @see org.w3c.dom.TypeInfo#getTypeNamespace()
114      */

115     public String JavaDoc getTypeNamespace() { return null;}
116     /**
117      * @see or.gw3c.dom.TypeInfo#isDerivedFrom(String,String,int)
118      */

119     public boolean isDerivedFrom( String JavaDoc ns, String JavaDoc localName, int derivationMethod ) {
120         return false;
121     }
122     
123     public TypeInfo JavaDoc getSchemaTypeInfo() { return this; }
124     public boolean isId( ) { return false; }
125
126       /**
127      * Associate an object to a key on this node. The object can later be
128      * retrieved from this node by calling <code>getUserData</code> with the
129      * same key.
130      * @param key The key to associate the object to.
131      * @param data The object to associate to the given key, or
132      * <code>null</code> to remove any existing association to that key.
133      * @param handler The handler to associate to that key, or
134      * <code>null</code>.
135      * @return Returns the <code>DOMObject</code> previously associated to
136      * the given key on this node, or <code>null</code> if there was none.
137      * @since DOM Level 3
138      */

139     public Object JavaDoc setUserData(String JavaDoc key,
140                               Object JavaDoc data,
141                               UserDataHandler JavaDoc handler) {
142         return getOwnerDocument().setUserData( key, data, handler);
143     }
144
145     /**
146      * Retrieves the object associated to a key on a this node. The object
147      * must first have been set to this node by calling
148      * <code>setUserData</code> with the same key.
149      * @param key The key the object is associated to.
150      * @return Returns the <code>DOMObject</code> associated to the given key
151      * on this node, or <code>null</code> if there was none.
152      * @since DOM Level 3
153      */

154     public Object JavaDoc getUserData(String JavaDoc key) {
155         return getOwnerDocument().getUserData( key);
156     }
157
158       /**
159      * This method returns a specialized object which implements the
160      * specialized APIs of the specified feature and version. The
161      * specialized object may also be obtained by using binding-specific
162      * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
163      * @param feature The name of the feature requested (case-insensitive).
164      * @param version This is the version number of the feature to test. If
165      * the version is <code>null</code> or the empty string, supporting
166      * any version of the feature will cause the method to return an
167      * object that supports at least one version of the feature.
168      * @return Returns an object which implements the specialized APIs of
169      * the specified feature and version, if any, or <code>null</code> if
170      * there is no object which implements interfaces associated with that
171      * feature. If the <code>DOMObject</code> returned by this method
172      * implements the <code>Node</code> interface, it must delegate to the
173      * primary core <code>Node</code> and not return results inconsistent
174      * with the primary core <code>Node</code> such as attributes,
175      * childNodes, etc.
176      * @since DOM Level 3
177      */

178     public Object JavaDoc getFeature(String JavaDoc feature, String JavaDoc version) {
179         // we don't have any alternate node, either this node does the job
180
// or we don't have anything that does
181
return isSupported(feature, version) ? this : null;
182     }
183
184     /**
185      * Tests whether two nodes are equal.
186      * <br>This method tests for equality of nodes, not sameness (i.e.,
187      * whether the two nodes are references to the same object) which can be
188      * tested with <code>Node.isSameNode</code>. All nodes that are the same
189      * will also be equal, though the reverse may not be true.
190      * <br>Two nodes are equal if and only if the following conditions are
191      * satisfied: The two nodes are of the same type.The following string
192      * attributes are equal: <code>nodeName</code>, <code>localName</code>,
193      * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
194      * , <code>baseURI</code>. This is: they are both <code>null</code>, or
195      * they have the same length and are character for character identical.
196      * The <code>attributes</code> <code>NamedNodeMaps</code> are equal.
197      * This is: they are both <code>null</code>, or they have the same
198      * length and for each node that exists in one map there is a node that
199      * exists in the other map and is equal, although not necessarily at the
200      * same index.The <code>childNodes</code> <code>NodeLists</code> are
201      * equal. This is: they are both <code>null</code>, or they have the
202      * same length and contain equal nodes at the same index. This is true
203      * for <code>Attr</code> nodes as for any other type of node. Note that
204      * normalization can affect equality; to avoid this, nodes should be
205      * normalized before being compared.
206      * <br>For two <code>DocumentType</code> nodes to be equal, the following
207      * conditions must also be satisfied: The following string attributes
208      * are equal: <code>publicId</code>, <code>systemId</code>,
209      * <code>internalSubset</code>.The <code>entities</code>
210      * <code>NamedNodeMaps</code> are equal.The <code>notations</code>
211      * <code>NamedNodeMaps</code> are equal.
212      * <br>On the other hand, the following do not affect equality: the
213      * <code>ownerDocument</code> attribute, the <code>specified</code>
214      * attribute for <code>Attr</code> nodes, the
215      * <code>isWhitespaceInElementContent</code> attribute for
216      * <code>Text</code> nodes, as well as any user data or event listeners
217      * registered on the nodes.
218      * @param arg The node to compare equality with.
219      * @param deep If <code>true</code>, recursively compare the subtrees; if
220      * <code>false</code>, compare only the nodes themselves (and its
221      * attributes, if it is an <code>Element</code>).
222      * @return If the nodes, and possibly subtrees are equal,
223      * <code>true</code> otherwise <code>false</code>.
224      * @since DOM Level 3
225      */

226     public boolean isEqualNode(Node JavaDoc arg) {
227         if (arg == this) {
228             return true;
229         }
230         if (arg.getNodeType() != getNodeType()) {
231             return false;
232         }
233         // in theory nodeName can't be null but better be careful
234
// who knows what other implementations may be doing?...
235
if (getNodeName() == null) {
236             if (arg.getNodeName() != null) {
237                 return false;
238             }
239         }
240         else if (!getNodeName().equals(arg.getNodeName())) {
241             return false;
242         }
243
244         if (getLocalName() == null) {
245             if (arg.getLocalName() != null) {
246                 return false;
247             }
248         }
249         else if (!getLocalName().equals(arg.getLocalName())) {
250             return false;
251         }
252
253         if (getNamespaceURI() == null) {
254             if (arg.getNamespaceURI() != null) {
255                 return false;
256             }
257         }
258         else if (!getNamespaceURI().equals(arg.getNamespaceURI())) {
259             return false;
260         }
261
262         if (getPrefix() == null) {
263             if (arg.getPrefix() != null) {
264                 return false;
265             }
266         }
267         else if (!getPrefix().equals(arg.getPrefix())) {
268             return false;
269         }
270
271         if (getNodeValue() == null) {
272             if (arg.getNodeValue() != null) {
273                 return false;
274             }
275         }
276         else if (!getNodeValue().equals(arg.getNodeValue())) {
277             return false;
278         }
279     /*
280         if (getBaseURI() == null) {
281             if (((NodeImpl) arg).getBaseURI() != null) {
282                 return false;
283             }
284         }
285         else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
286             return false;
287         }
288 */

289
290              return true;
291     }
292
293       /**
294      * DOM Level 3 - Experimental:
295      * Look up the namespace URI associated to the given prefix, starting from this node.
296      * Use lookupNamespaceURI(null) to lookup the default namespace
297      *
298      * @param namespaceURI
299      * @return th URI for the namespace
300      * @since DOM Level 3
301      */

302     public String JavaDoc lookupNamespaceURI(String JavaDoc specifiedPrefix) {
303         short type = this.getNodeType();
304         switch (type) {
305         case Node.ELEMENT_NODE : {
306
307                 String JavaDoc namespace = this.getNamespaceURI();
308                 String JavaDoc prefix = this.getPrefix();
309                 if (namespace !=null) {
310                     // REVISIT: is it possible that prefix is empty string?
311
if (specifiedPrefix== null && prefix==specifiedPrefix) {
312                         // looking for default namespace
313
return namespace;
314                     } else if (prefix != null && prefix.equals(specifiedPrefix)) {
315                         // non default namespace
316
return namespace;
317                     }
318                 }
319                 if (this.hasAttributes()) {
320                     NamedNodeMap JavaDoc map = this.getAttributes();
321                     int length = map.getLength();
322                     for (int i=0;i<length;i++) {
323                         Node JavaDoc attr = map.item(i);
324                         String JavaDoc attrPrefix = attr.getPrefix();
325                         String JavaDoc value = attr.getNodeValue();
326                         namespace = attr.getNamespaceURI();
327                         if (namespace !=null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
328                             // at this point we are dealing with DOM Level 2 nodes only
329
if (specifiedPrefix == null &&
330                                 attr.getNodeName().equals("xmlns")) {
331                                 // default namespace
332
return value;
333                             } else if (attrPrefix !=null &&
334                                        attrPrefix.equals("xmlns") &&
335                                        attr.getLocalName().equals(specifiedPrefix)) {
336                  // non default namespace
337
return value;
338                             }
339                         }
340                     }
341                 }
342         /*
343                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
344                 if (ancestor != null) {
345                     return ancestor.lookupNamespaceURI(specifiedPrefix);
346                 }
347         */

348
349                 return null;
350
351
352             }
353 /*
354         case Node.DOCUMENT_NODE : {
355                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
356             }
357 */

358         case Node.ENTITY_NODE :
359         case Node.NOTATION_NODE:
360         case Node.DOCUMENT_FRAGMENT_NODE:
361         case Node.DOCUMENT_TYPE_NODE:
362             // type is unknown
363
return null;
364         case Node.ATTRIBUTE_NODE:{
365                 if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
366                     return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
367
368                 }
369                 return null;
370             }
371         default:{
372        /*
373                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
374                 if (ancestor != null) {
375                     return ancestor.lookupNamespaceURI(specifiedPrefix);
376                 }
377              */

378                 return null;
379             }
380
381         }
382     }
383
384     
385     /**
386      * DOM Level 3: Experimental
387      * This method checks if the specified <code>namespaceURI</code> is the
388      * default namespace or not.
389      * @param namespaceURI The namespace URI to look for.
390      * @return <code>true</code> if the specified <code>namespaceURI</code>
391      * is the default namespace, <code>false</code> otherwise.
392      * @since DOM Level 3
393      */

394     public boolean isDefaultNamespace(String JavaDoc namespaceURI){
395        /*
396         // REVISIT: remove casts when DOM L3 becomes REC.
397         short type = this.getNodeType();
398         switch (type) {
399         case Node.ELEMENT_NODE: {
400             String namespace = this.getNamespaceURI();
401             String prefix = this.getPrefix();
402
403             // REVISIT: is it possible that prefix is empty string?
404             if (prefix == null || prefix.length() == 0) {
405                 if (namespaceURI == null) {
406                     return (namespace == namespaceURI);
407                 }
408                 return namespaceURI.equals(namespace);
409             }
410             if (this.hasAttributes()) {
411                 ElementImpl elem = (ElementImpl)this;
412                 NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns");
413                 if (attr != null) {
414                     String value = attr.getNodeValue();
415                     if (namespaceURI == null) {
416                         return (namespace == value);
417                     }
418                     return namespaceURI.equals(value);
419                 }
420             }
421
422             NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
423             if (ancestor != null) {
424                 return ancestor.isDefaultNamespace(namespaceURI);
425             }
426             return false;
427         }
428         case Node.DOCUMENT_NODE:{
429                 return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI);
430             }
431
432         case Node.ENTITY_NODE :
433           case Node.NOTATION_NODE:
434         case Node.DOCUMENT_FRAGMENT_NODE:
435         case Node.DOCUMENT_TYPE_NODE:
436             // type is unknown
437             return false;
438         case Node.ATTRIBUTE_NODE:{
439                 if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
440                     return ownerNode.isDefaultNamespace(namespaceURI);
441
442                 }
443                 return false;
444             }
445         default:{
446                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
447                 if (ancestor != null) {
448                     return ancestor.isDefaultNamespace(namespaceURI);
449                 }
450                 return false;
451             }
452
453         }
454 */

455         return false;
456
457
458     }
459
460       /**
461      *
462      * DOM Level 3 - Experimental:
463      * Look up the prefix associated to the given namespace URI, starting from this node.
464      *
465      * @param namespaceURI
466      * @return the prefix for the namespace
467      */

468     public String JavaDoc lookupPrefix(String JavaDoc namespaceURI){
469
470         // REVISIT: When Namespaces 1.1 comes out this may not be true
471
// Prefix can't be bound to null namespace
472
if (namespaceURI == null) {
473             return null;
474         }
475
476         short type = this.getNodeType();
477
478         switch (type) {
479 /*
480         case Node.ELEMENT_NODE: {
481
482                 String namespace = this.getNamespaceURI(); // to flip out children
483                 return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
484             }
485
486         case Node.DOCUMENT_NODE:{
487                 return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
488             }
489 */

490         case Node.ENTITY_NODE :
491         case Node.NOTATION_NODE:
492         case Node.DOCUMENT_FRAGMENT_NODE:
493         case Node.DOCUMENT_TYPE_NODE:
494             // type is unknown
495
return null;
496         case Node.ATTRIBUTE_NODE:{
497                 if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
498                     return getOwnerElement().lookupPrefix(namespaceURI);
499
500                 }
501                 return null;
502             }
503         default:{
504 /*
505                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
506                 if (ancestor != null) {
507                     return ancestor.lookupPrefix(namespaceURI);
508                 }
509 */

510                 return null;
511             }
512          }
513     }
514
515      /**
516      * Returns whether this node is the same node as the given one.
517      * <br>This method provides a way to determine whether two
518      * <code>Node</code> references returned by the implementation reference
519      * the same object. When two <code>Node</code> references are references
520      * to the same object, even if through a proxy, the references may be
521      * used completely interchangably, such that all attributes have the
522      * same values and calling the same DOM method on either reference
523      * always has exactly the same effect.
524      * @param other The node to test against.
525      * @return Returns <code>true</code> if the nodes are the same,
526      * <code>false</code> otherwise.
527      * @since DOM Level 3
528      */

529     public boolean isSameNode(Node JavaDoc other) {
530         // we do not use any wrapper so the answer is obvious
531
return this == other;
532     }
533
534       /**
535      * This attribute returns the text content of this node and its
536      * descendants. When it is defined to be null, setting it has no effect.
537      * When set, any possible children this node may have are removed and
538      * replaced by a single <code>Text</code> node containing the string
539      * this attribute is set to. On getting, no serialization is performed,
540      * the returned string does not contain any markup. No whitespace
541      * normalization is performed, the returned string does not contain the
542      * element content whitespaces . Similarly, on setting, no parsing is
543      * performed either, the input string is taken as pure textual content.
544      * <br>The string returned is made of the text content of this node
545      * depending on its type, as defined below:
546      * <table border='1'>
547      * <tr>
548      * <th>Node type</th>
549      * <th>Content</th>
550      * </tr>
551      * <tr>
552      * <td valign='top' rowspan='1' colspan='1'>
553      * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
554      * DOCUMENT_FRAGMENT_NODE</td>
555      * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
556      * attribute value of every child node, excluding COMMENT_NODE and
557      * PROCESSING_INSTRUCTION_NODE nodes</td>
558      * </tr>
559      * <tr>
560      * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
561      * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
562      * <td valign='top' rowspan='1' colspan='1'>
563      * <code>nodeValue</code></td>
564      * </tr>
565      * <tr>
566      * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
567      * <td valign='top' rowspan='1' colspan='1'>
568      * null</td>
569      * </tr>
570      * </table>
571      * @exception DOMException
572      * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
573      * @exception DOMException
574      * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
575      * fit in a <code>DOMString</code> variable on the implementation
576      * platform.
577        * @since DOM Level 3
578      */

579     public void setTextContent(String JavaDoc textContent)
580         throws DOMException JavaDoc {
581         setNodeValue(textContent);
582     }
583     /**
584      * This attribute returns the text content of this node and its
585      * descendants. When it is defined to be null, setting it has no effect.
586      * When set, any possible children this node may have are removed and
587      * replaced by a single <code>Text</code> node containing the string
588      * this attribute is set to. On getting, no serialization is performed,
589      * the returned string does not contain any markup. No whitespace
590      * normalization is performed, the returned string does not contain the
591      * element content whitespaces . Similarly, on setting, no parsing is
592      * performed either, the input string is taken as pure textual content.
593      * <br>The string returned is made of the text content of this node
594      * depending on its type, as defined below:
595      * <table border='1'>
596      * <tr>
597      * <th>Node type</th>
598      * <th>Content</th>
599      * </tr>
600      * <tr>
601      * <td valign='top' rowspan='1' colspan='1'>
602      * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
603      * DOCUMENT_FRAGMENT_NODE</td>
604      * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
605      * attribute value of every child node, excluding COMMENT_NODE and
606      * PROCESSING_INSTRUCTION_NODE nodes</td>
607      * </tr>
608      * <tr>
609      * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
610      * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
611      * <td valign='top' rowspan='1' colspan='1'>
612      * <code>nodeValue</code></td>
613      * </tr>
614      * <tr>
615      * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
616      * <td valign='top' rowspan='1' colspan='1'>
617      * null</td>
618      * </tr>
619      * </table>
620      * @exception DOMException
621      * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
622      * @exception DOMException
623      * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
624      * fit in a <code>DOMString</code> variable on the implementation
625      * platform.
626      * @since DOM Level 3
627      */

628     public String JavaDoc getTextContent() throws DOMException JavaDoc {
629         return getNodeValue(); // overriden in some subclasses
630
}
631
632      /**
633      * Compares a node with this node with regard to their position in the
634      * document.
635      * @param other The node to compare against this node.
636      * @return Returns how the given node is positioned relatively to this
637      * node.
638      * @since DOM Level 3
639      */

640     public short compareDocumentPosition(Node JavaDoc other) throws DOMException JavaDoc {
641         return 0;
642     }
643
644      /**
645      * The absolute base URI of this node or <code>null</code> if undefined.
646      * This value is computed according to . However, when the
647      * <code>Document</code> supports the feature "HTML" , the base URI is
648      * computed using first the value of the href attribute of the HTML BASE
649      * element if any, and the value of the <code>documentURI</code>
650      * attribute from the <code>Document</code> interface otherwise.
651      * <br> When the node is an <code>Element</code>, a <code>Document</code>
652      * or a a <code>ProcessingInstruction</code>, this attribute represents
653      * the properties [base URI] defined in . When the node is a
654      * <code>Notation</code>, an <code>Entity</code>, or an
655      * <code>EntityReference</code>, this attribute represents the
656      * properties [declaration base URI] in the . How will this be affected
657      * by resolution of relative namespace URIs issue?It's not.Should this
658      * only be on Document, Element, ProcessingInstruction, Entity, and
659      * Notation nodes, according to the infoset? If not, what is it equal to
660      * on other nodes? Null? An empty string? I think it should be the
661      * parent's.No.Should this be read-only and computed or and actual
662      * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
663      * teleconference 30 May 2001).If the base HTML element is not yet
664      * attached to a document, does the insert change the Document.baseURI?
665      * Yes. (F2F 26 Sep 2001)
666      * @since DOM Level 3
667      */

668     public String JavaDoc getBaseURI() {
669         return null;
670     }
671
672
673
674 }
675
676
Popular Tags