• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the  "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 /*
19  * $Id: UnImplNode.java 468655 2006-10-28 07:12:06Z minchau $
20  */
21 package org.apache.xml.utils;
22 
23 import org.apache.xml.res.XMLErrorResources;
24 import org.apache.xml.res.XMLMessages;
25 
26 import org.w3c.dom.Attr;
27 import org.w3c.dom.CDATASection;
28 import org.w3c.dom.Comment;
29 import org.w3c.dom.DOMException;
30 import org.w3c.dom.DOMImplementation;
31 import org.w3c.dom.Document;
32 import org.w3c.dom.DocumentFragment;
33 import org.w3c.dom.DocumentType;
34 import org.w3c.dom.Element;
35 import org.w3c.dom.EntityReference;
36 import org.w3c.dom.NamedNodeMap;
37 import org.w3c.dom.Node;
38 import org.w3c.dom.NodeList;
39 import org.w3c.dom.ProcessingInstruction;
40 import org.w3c.dom.Text;
41 
42 import org.w3c.dom.UserDataHandler;
43 import org.w3c.dom.DOMConfiguration;
44 import org.w3c.dom.TypeInfo;
45 /**
46  * To be subclassed by classes that wish to fake being nodes.
47  * @xsl.usage internal
48  */
49 public class UnImplNode implements Node, Element, NodeList, Document
50 {
51 
52   /**
53    * Constructor UnImplNode
54    *
55    */
UnImplNode()56   public UnImplNode(){}
57 
58   /**
59    * Throw an error.
60    *
61    * @param msg Message Key for the error
62    */
error(String msg)63   public void error(String msg)
64   {
65 
66     System.out.println("DOM ERROR! class: " + this.getClass().getName());
67 
68     throw new RuntimeException(XMLMessages.createXMLMessage(msg, null));
69   }
70 
71   /**
72    * Throw an error.
73    *
74    * @param msg Message Key for the error
75    * @param args Array of arguments to be used in the error message
76    */
error(String msg, Object[] args)77   public void error(String msg, Object[] args)
78   {
79 
80     System.out.println("DOM ERROR! class: " + this.getClass().getName());
81 
82     throw new RuntimeException(XMLMessages.createXMLMessage(msg, args));  //"UnImplNode error: "+msg);
83   }
84 
85   /**
86    * Unimplemented. See org.w3c.dom.Node
87    *
88    * @param newChild New node to append to the list of this node's children
89    *
90    * @return null
91    *
92    * @throws DOMException
93    */
appendChild(Node newChild)94   public Node appendChild(Node newChild) throws DOMException
95   {
96 
97     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"appendChild not supported!");
98 
99     return null;
100   }
101 
102   /**
103    * Unimplemented. See org.w3c.dom.Node
104    *
105    * @return false
106    */
hasChildNodes()107   public boolean hasChildNodes()
108   {
109 
110     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasChildNodes not supported!");
111 
112     return false;
113   }
114 
115   /**
116    * Unimplemented. See org.w3c.dom.Node
117    *
118    * @return 0
119    */
getNodeType()120   public short getNodeType()
121   {
122 
123     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNodeType not supported!");
124 
125     return 0;
126   }
127 
128   /**
129    * Unimplemented. See org.w3c.dom.Node
130    *
131    * @return null
132    */
getParentNode()133   public Node getParentNode()
134   {
135 
136     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getParentNode not supported!");
137 
138     return null;
139   }
140 
141   /**
142    * Unimplemented. See org.w3c.dom.Node
143    *
144    * @return null
145    */
getChildNodes()146   public NodeList getChildNodes()
147   {
148 
149     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getChildNodes not supported!");
150 
151     return null;
152   }
153 
154   /**
155    * Unimplemented. See org.w3c.dom.Node
156    *
157    * @return null
158    */
getFirstChild()159   public Node getFirstChild()
160   {
161 
162     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getFirstChild not supported!");
163 
164     return null;
165   }
166 
167   /**
168    * Unimplemented. See org.w3c.dom.Node
169    *
170    * @return null
171    */
getLastChild()172   public Node getLastChild()
173   {
174 
175     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getLastChild not supported!");
176 
177     return null;
178   }
179 
180   /**
181    * Unimplemented. See org.w3c.dom.Node
182    *
183    * @return null
184    */
getNextSibling()185   public Node getNextSibling()
186   {
187 
188     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNextSibling not supported!");
189 
190     return null;
191   }
192 
193   /**
194    * Unimplemented. See org.w3c.dom.NodeList
195    *
196    * @return 0
197    */
getLength()198   public int getLength()
199   {
200 
201     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getLength not supported!");
202 
203     return 0;
204   }  // getLength():int
205 
206   /**
207    * Unimplemented. See org.w3c.dom.NodeList
208    *
209    * @param index index of a child of this node in its list of children
210    *
211    * @return null
212    */
item(int index)213   public Node item(int index)
214   {
215 
216     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"item not supported!");
217 
218     return null;
219   }  // item(int):Node
220 
221   /**
222    * Unimplemented. See org.w3c.dom.Node
223    *
224    * @return null
225    */
getOwnerDocument()226   public Document getOwnerDocument()
227   {
228 
229     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getOwnerDocument not supported!");
230 
231     return null;
232   }
233 
234   /**
235    * Unimplemented. See org.w3c.dom.Node
236    *
237    * @return null
238    */
getTagName()239   public String getTagName()
240   {
241 
242     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getTagName not supported!");
243 
244     return null;
245   }
246 
247   /**
248    * Unimplemented. See org.w3c.dom.Node
249    *
250    * @return null
251    */
getNodeName()252   public String getNodeName()
253   {
254 
255     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNodeName not supported!");
256 
257     return null;
258   }
259 
260   /** Unimplemented. See org.w3c.dom.Node */
normalize()261   public void normalize()
262   {
263     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"normalize not supported!");
264   }
265 
266   /**
267    * Unimplemented. See org.w3c.dom.Element
268    *
269    * @param name Name of the element
270    *
271    * @return null
272    */
getElementsByTagName(String name)273   public NodeList getElementsByTagName(String name)
274   {
275 
276     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getElementsByTagName not supported!");
277 
278     return null;
279   }
280 
281   /**
282    * Unimplemented. See org.w3c.dom.Element
283    *
284    * @param oldAttr Attribute to be removed from this node's list of attributes
285    *
286    * @return null
287    *
288    * @throws DOMException
289    */
removeAttributeNode(Attr oldAttr)290   public Attr removeAttributeNode(Attr oldAttr) throws DOMException
291   {
292 
293     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"removeAttributeNode not supported!");
294 
295     return null;
296   }
297 
298   /**
299    * Unimplemented. See org.w3c.dom.Element
300    *
301    * @param newAttr Attribute node to be added to this node's list of attributes
302    *
303    * @return null
304    *
305    * @throws DOMException
306    */
setAttributeNode(Attr newAttr)307   public Attr setAttributeNode(Attr newAttr) throws DOMException
308   {
309 
310     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttributeNode not supported!");
311 
312     return null;
313   }
314 
315   /**
316    * Unimplemented. See org.w3c.dom.Element
317    *
318    *
319    * @param name Name of an attribute
320    *
321    * @return false
322    */
hasAttribute(String name)323   public boolean hasAttribute(String name)
324   {
325 
326     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasAttribute not supported!");
327 
328     return false;
329   }
330 
331   /**
332    * Unimplemented. See org.w3c.dom.Element
333    *
334    *
335    * @param name
336    * @param x
337    *
338    * @return false
339    */
hasAttributeNS(String name, String x)340   public boolean hasAttributeNS(String name, String x)
341   {
342 
343     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasAttributeNS not supported!");
344 
345     return false;
346   }
347 
348   /**
349    * Unimplemented. See org.w3c.dom.Element
350    *
351    *
352    * @param name Attribute node name
353    *
354    * @return null
355    */
getAttributeNode(String name)356   public Attr getAttributeNode(String name)
357   {
358 
359     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributeNode not supported!");
360 
361     return null;
362   }
363 
364   /**
365    * Unimplemented. See org.w3c.dom.Element
366    *
367    * @param name Attribute node name to remove from list of attributes
368    *
369    * @throws DOMException
370    */
removeAttribute(String name)371   public void removeAttribute(String name) throws DOMException
372   {
373     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"removeAttribute not supported!");
374   }
375 
376   /**
377    * Unimplemented. See org.w3c.dom.Element
378    *
379    * @param name Name of attribute to set
380    * @param value Value of attribute
381    *
382    * @throws DOMException
383    */
setAttribute(String name, String value)384   public void setAttribute(String name, String value) throws DOMException
385   {
386     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttribute not supported!");
387   }
388 
389   /**
390    * Unimplemented. See org.w3c.dom.Element
391    *
392    * @param name Name of attribute to get
393    *
394    * @return null
395    */
getAttribute(String name)396   public String getAttribute(String name)
397   {
398 
399     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttribute not supported!");
400 
401     return null;
402   }
403 
404   /**
405    * Unimplemented. Introduced in DOM Level 2.
406    *
407    * @return false
408    */
hasAttributes()409   public boolean hasAttributes()
410   {
411 
412     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasAttributes not supported!");
413 
414     return false;
415   }
416 
417   /**
418    * Unimplemented. See org.w3c.dom.Element
419    *
420    * @param namespaceURI Namespace URI of the element
421    * @param localName Local part of qualified name of the element
422    *
423    * @return null
424    */
getElementsByTagNameNS(String namespaceURI, String localName)425   public NodeList getElementsByTagNameNS(String namespaceURI,
426                                          String localName)
427   {
428 
429     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getElementsByTagNameNS not supported!");
430 
431     return null;
432   }
433 
434   /**
435    * Unimplemented. See org.w3c.dom.Element
436    *
437    * @param newAttr Attribute to set
438    *
439    * @return null
440    *
441    * @throws DOMException
442    */
setAttributeNodeNS(Attr newAttr)443   public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
444   {
445 
446     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttributeNodeNS not supported!");
447 
448     return null;
449   }
450 
451   /**
452    * Unimplemented. See org.w3c.dom.Element
453    *
454    * @param namespaceURI Namespace URI of attribute node to get
455    * @param localName Local part of qualified name of attribute node to get
456    *
457    * @return null
458    */
getAttributeNodeNS(String namespaceURI, String localName)459   public Attr getAttributeNodeNS(String namespaceURI, String localName)
460   {
461 
462     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributeNodeNS not supported!");
463 
464     return null;
465   }
466 
467   /**
468    * Unimplemented. See org.w3c.dom.Element
469    *
470    * @param namespaceURI Namespace URI of attribute node to remove
471    * @param localName Local part of qualified name of attribute node to remove
472    *
473    * @throws DOMException
474    */
removeAttributeNS(String namespaceURI, String localName)475   public void removeAttributeNS(String namespaceURI, String localName)
476           throws DOMException
477   {
478     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"removeAttributeNS not supported!");
479   }
480 
481   /**
482    * Unimplemented. See org.w3c.dom.Element
483    *
484    * @param namespaceURI Namespace URI of attribute node to set
485    * NEEDSDOC @param qualifiedName
486    * @param value value of attribute
487    *
488    * @throws DOMException
489    */
setAttributeNS( String namespaceURI, String qualifiedName, String value)490   public void setAttributeNS(
491           String namespaceURI, String qualifiedName, String value)
492             throws DOMException
493   {
494     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttributeNS not supported!");
495   }
496 
497   /**
498    * Unimplemented. See org.w3c.dom.Element
499    *
500    * @param namespaceURI Namespace URI of attribute node to get
501    * @param localName Local part of qualified name of attribute node to get
502    *
503    * @return null
504    */
getAttributeNS(String namespaceURI, String localName)505   public String getAttributeNS(String namespaceURI, String localName)
506   {
507 
508     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributeNS not supported!");
509 
510     return null;
511   }
512 
513   /**
514    * Unimplemented. See org.w3c.dom.Node
515    *
516    * @return null
517    */
getPreviousSibling()518   public Node getPreviousSibling()
519   {
520 
521     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getPreviousSibling not supported!");
522 
523     return null;
524   }
525 
526   /**
527    * Unimplemented. See org.w3c.dom.Node
528    *
529    * @param deep Flag indicating whether to clone deep (clone member variables)
530    *
531    * @return null
532    */
cloneNode(boolean deep)533   public Node cloneNode(boolean deep)
534   {
535 
536     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"cloneNode not supported!");
537 
538     return null;
539   }
540 
541   /**
542    * Unimplemented. See org.w3c.dom.Node
543    *
544    * @return null
545    *
546    * @throws DOMException
547    */
getNodeValue()548   public String getNodeValue() throws DOMException
549   {
550 
551     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNodeValue not supported!");
552 
553     return null;
554   }
555 
556   /**
557    * Unimplemented. See org.w3c.dom.Node
558    *
559    * @param nodeValue Value to set this node to
560    *
561    * @throws DOMException
562    */
setNodeValue(String nodeValue)563   public void setNodeValue(String nodeValue) throws DOMException
564   {
565     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setNodeValue not supported!");
566   }
567 
568   /**
569    * Unimplemented. See org.w3c.dom.Node
570    *
571    *
572    * NEEDSDOC @param value
573    * @return value Node value
574    *
575    * @throws DOMException
576    */
577 
578   // public String getValue ()
579   // {
580   //  error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getValue not supported!");
581   //  return null;
582   // }
583 
584   /**
585    * Unimplemented. See org.w3c.dom.Node
586    *
587    * @param value Value to set this node to
588    *
589    * @throws DOMException
590    */
setValue(String value)591   public void setValue(String value) throws DOMException
592   {
593     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setValue not supported!");
594   }
595 
596   /**
597    *  Returns the name of this attribute.
598    *
599    * @return the name of this attribute.
600    */
601 
602   // public String getName()
603   // {
604   //  return this.getNodeName();
605   // }
606 
607   /**
608    * Unimplemented. See org.w3c.dom.Node
609    *
610    * @return null
611    */
getOwnerElement()612   public Element getOwnerElement()
613   {
614 
615     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getOwnerElement not supported!");
616 
617     return null;
618   }
619 
620   /**
621    * Unimplemented. See org.w3c.dom.Node
622    *
623    * @return False
624    */
getSpecified()625   public boolean getSpecified()
626   {
627 
628     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setValue not supported!");
629 
630     return false;
631   }
632 
633   /**
634    * Unimplemented. See org.w3c.dom.Node
635    *
636    * @return null
637    */
getAttributes()638   public NamedNodeMap getAttributes()
639   {
640 
641     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributes not supported!");
642 
643     return null;
644   }
645 
646   /**
647    * Unimplemented. See org.w3c.dom.Node
648    *
649    * @param newChild New child node to insert
650    * @param refChild Insert in front of this child
651    *
652    * @return null
653    *
654    * @throws DOMException
655    */
insertBefore(Node newChild, Node refChild)656   public Node insertBefore(Node newChild, Node refChild) throws DOMException
657   {
658 
659     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"insertBefore not supported!");
660 
661     return null;
662   }
663 
664   /**
665    * Unimplemented. See org.w3c.dom.Node
666    *
667    * @param newChild Replace existing child with this one
668    * @param oldChild Existing child to be replaced
669    *
670    * @return null
671    *
672    * @throws DOMException
673    */
replaceChild(Node newChild, Node oldChild)674   public Node replaceChild(Node newChild, Node oldChild) throws DOMException
675   {
676 
677     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"replaceChild not supported!");
678 
679     return null;
680   }
681 
682   /**
683    * Unimplemented. See org.w3c.dom.Node
684    *
685    * @param oldChild Child to be removed
686    *
687    * @return null
688    *
689    * @throws DOMException
690    */
removeChild(Node oldChild)691   public Node removeChild(Node oldChild) throws DOMException
692   {
693 
694     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"replaceChild not supported!");
695 
696     return null;
697   }
698 
699   /**
700    * Tests whether the DOM implementation implements a specific feature and
701    * that feature is supported by this node.
702    * @param feature The name of the feature to test. This is the same name
703    *   which can be passed to the method <code>hasFeature</code> on
704    *   <code>DOMImplementation</code>.
705    * @param version This is the version number of the feature to test. In
706    *   Level 2, version 1, this is the string "2.0". If the version is not
707    *   specified, supporting any version of the feature will cause the
708    *   method to return <code>true</code>.
709    *
710    * @return Returns <code>false</code>
711    * @since DOM Level 2
712    */
isSupported(String feature, String version)713   public boolean isSupported(String feature, String version)
714   {
715     return false;
716   }
717 
718   /**
719    * Unimplemented. See org.w3c.dom.Node
720    *
721    * @return null
722    */
getNamespaceURI()723   public String getNamespaceURI()
724   {
725 
726     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNamespaceURI not supported!");
727 
728     return null;
729   }
730 
731   /**
732    * Unimplemented. See org.w3c.dom.Node
733    *
734    * @return null
735    */
getPrefix()736   public String getPrefix()
737   {
738 
739     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getPrefix not supported!");
740 
741     return null;
742   }
743 
744   /**
745    * Unimplemented. See org.w3c.dom.Node
746    *
747    * @param prefix Prefix to set for this node
748    *
749    * @throws DOMException
750    */
setPrefix(String prefix)751   public void setPrefix(String prefix) throws DOMException
752   {
753     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setPrefix not supported!");
754   }
755 
756   /**
757    * Unimplemented. See org.w3c.dom.Node
758    *
759    * @return null
760    */
getLocalName()761   public String getLocalName()
762   {
763 
764     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getLocalName not supported!");
765 
766     return null;
767   }
768 
769   /**
770    * Unimplemented. See org.w3c.dom.Document
771    *
772    * @return null
773    */
getDoctype()774   public DocumentType getDoctype()
775   {
776 
777     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
778 
779     return null;
780   }
781 
782   /**
783    * Unimplemented. See org.w3c.dom.Document
784    *
785    * @return null
786    */
getImplementation()787   public DOMImplementation getImplementation()
788   {
789 
790     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
791 
792     return null;
793   }
794 
795   /**
796    * Unimplemented. See org.w3c.dom.Document
797    *
798    * @return null
799    */
getDocumentElement()800   public Element getDocumentElement()
801   {
802 
803     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
804 
805     return null;
806   }
807 
808   /**
809    * Unimplemented. See org.w3c.dom.Document
810    *
811    * @param tagName Element tag name
812    *
813    * @return null
814    *
815    * @throws DOMException
816    */
createElement(String tagName)817   public Element createElement(String tagName) throws DOMException
818   {
819 
820     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
821 
822     return null;
823   }
824 
825   /**
826    * Unimplemented. See org.w3c.dom.Document
827    *
828    * @return null
829    */
createDocumentFragment()830   public DocumentFragment createDocumentFragment()
831   {
832 
833     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
834 
835     return null;
836   }
837 
838   /**
839    * Unimplemented. See org.w3c.dom.Document
840    *
841    * @param data Data for text node
842    *
843    * @return null
844    */
createTextNode(String data)845   public Text createTextNode(String data)
846   {
847 
848     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
849 
850     return null;
851   }
852 
853   /**
854    * Unimplemented. See org.w3c.dom.Document
855    *
856    * @param data Data for comment
857    *
858    * @return null
859    */
createComment(String data)860   public Comment createComment(String data)
861   {
862 
863     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
864 
865     return null;
866   }
867 
868   /**
869    * Unimplemented. See org.w3c.dom.Document
870    *
871    * @param data Data for CDATA section
872    *
873    * @return null
874    *
875    * @throws DOMException
876    */
createCDATASection(String data)877   public CDATASection createCDATASection(String data) throws DOMException
878   {
879 
880     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
881 
882     return null;
883   }
884 
885   /**
886    * Unimplemented. See org.w3c.dom.Document
887    *
888    * @param target Target for Processing instruction
889    * @param data Data for Processing instruction
890    *
891    * @return null
892    *
893    * @throws DOMException
894    */
createProcessingInstruction( String target, String data)895   public ProcessingInstruction createProcessingInstruction(
896           String target, String data) throws DOMException
897   {
898 
899     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
900 
901     return null;
902   }
903 
904   /**
905    * Unimplemented. See org.w3c.dom.Document
906    *
907    * @param name Attribute name
908    *
909    * @return null
910    *
911    * @throws DOMException
912    */
createAttribute(String name)913   public Attr createAttribute(String name) throws DOMException
914   {
915 
916     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
917 
918     return null;
919   }
920 
921   /**
922    * Unimplemented. See org.w3c.dom.Document
923    *
924    * @param name Entity Reference name
925    *
926    * @return null
927    *
928    * @throws DOMException
929    */
createEntityReference(String name)930   public EntityReference createEntityReference(String name)
931           throws DOMException
932   {
933 
934     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
935 
936     return null;
937   }
938 
939   /**
940    * Unimplemented. See org.w3c.dom.Document
941    *
942    * @param importedNode The node to import.
943    * @param deep         If <code>true</code>, recursively import the subtree under
944    *   the specified node; if <code>false</code>, import only the node
945    *   itself, as explained above. This has no effect on <code>Attr</code>
946    *   , <code>EntityReference</code>, and <code>Notation</code> nodes.
947    *
948    * @return null
949    *
950    * @throws DOMException
951    */
importNode(Node importedNode, boolean deep)952   public Node importNode(Node importedNode, boolean deep) throws DOMException
953   {
954 
955     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
956 
957     return null;
958   }
959 
960   /**
961    * Unimplemented. See org.w3c.dom.Document
962    *
963    * @param namespaceURI Namespace URI for the element
964    * @param qualifiedName Qualified name of the element
965    *
966    * @return null
967    *
968    * @throws DOMException
969    */
createElementNS(String namespaceURI, String qualifiedName)970   public Element createElementNS(String namespaceURI, String qualifiedName)
971           throws DOMException
972   {
973 
974     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
975 
976     return null;
977   }
978 
979   /**
980    * Unimplemented. See org.w3c.dom.Document
981    *
982    * @param namespaceURI Namespace URI of the attribute
983    * @param qualifiedName Qualified name of the attribute
984    *
985    * @return null
986    *
987    * @throws DOMException
988    */
createAttributeNS(String namespaceURI, String qualifiedName)989   public Attr createAttributeNS(String namespaceURI, String qualifiedName)
990           throws DOMException
991   {
992 
993     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
994 
995     return null;
996   }
997 
998   /**
999    * Unimplemented. See org.w3c.dom.Document
1000    *
1001    * @param elementId ID of the element to get
1002    *
1003    * @return null
1004    */
getElementById(String elementId)1005   public Element getElementById(String elementId)
1006   {
1007 
1008     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1009 
1010     return null;
1011   }
1012 
1013   /**
1014    * Set Node data
1015    *
1016    *
1017    * @param data data to set for this node
1018    *
1019    * @throws DOMException
1020    */
setData(String data)1021   public void setData(String data) throws DOMException
1022   {
1023     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1024   }
1025 
1026   /**
1027    * Unimplemented.
1028    *
1029    * @param offset Start offset of substring to extract.
1030    * @param count The length of the substring to extract.
1031    *
1032    * @return null
1033    *
1034    * @throws DOMException
1035    */
substringData(int offset, int count)1036   public String substringData(int offset, int count) throws DOMException
1037   {
1038 
1039     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1040 
1041     return null;
1042   }
1043 
1044   /**
1045    * Unimplemented.
1046    *
1047    * @param arg String data to append
1048    *
1049    * @throws DOMException
1050    */
appendData(String arg)1051   public void appendData(String arg) throws DOMException
1052   {
1053     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1054   }
1055 
1056   /**
1057    * Unimplemented.
1058    *
1059    * @param offset Start offset of substring to insert.
1060    * NEEDSDOC @param arg
1061    *
1062    * @throws DOMException
1063    */
insertData(int offset, String arg)1064   public void insertData(int offset, String arg) throws DOMException
1065   {
1066     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1067   }
1068 
1069   /**
1070    * Unimplemented.
1071    *
1072    * @param offset Start offset of substring to delete.
1073    * @param count The length of the substring to delete.
1074    *
1075    * @throws DOMException
1076    */
deleteData(int offset, int count)1077   public void deleteData(int offset, int count) throws DOMException
1078   {
1079     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1080   }
1081 
1082   /**
1083    * Unimplemented.
1084    *
1085    * @param offset Start offset of substring to replace.
1086    * @param count The length of the substring to replace.
1087    * @param arg substring to replace with
1088    *
1089    * @throws DOMException
1090    */
replaceData(int offset, int count, String arg)1091   public void replaceData(int offset, int count, String arg)
1092           throws DOMException
1093   {
1094     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1095   }
1096 
1097   /**
1098    * Unimplemented.
1099    *
1100    * @param offset Offset into text to split
1101    *
1102    * @return null, unimplemented
1103    *
1104    * @throws DOMException
1105    */
splitText(int offset)1106   public Text splitText(int offset) throws DOMException
1107   {
1108 
1109     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1110 
1111     return null;
1112   }
1113 
1114   /**
1115    * NEEDSDOC Method adoptNode
1116    *
1117    *
1118    * NEEDSDOC @param source
1119    *
1120    * NEEDSDOC (adoptNode) @return
1121    *
1122    * @throws DOMException
1123    */
adoptNode(Node source)1124   public Node adoptNode(Node source) throws DOMException
1125   {
1126 
1127     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1128 
1129     return null;
1130   }
1131 
1132   /**
1133    * <p>Based on the <a
1134    * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1135    * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1136    * <p>
1137    * An attribute specifying, as part of the XML declaration, the encoding
1138    * of this document. This is <code>null</code> when unspecified.
1139    * @since DOM Level 3
1140    *
1141    * NEEDSDOC ($objectName$) @return
1142    */
getInputEncoding()1143   public String getInputEncoding()
1144   {
1145 
1146     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1147 
1148     return null;
1149   }
1150 
1151   /**
1152    * <p>Based on the <a
1153    * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1154    * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1155    * <p>
1156    * An attribute specifying, as part of the XML declaration, the encoding
1157    * of this document. This is <code>null</code> when unspecified.
1158    * @since DOM Level 3
1159    *
1160    * NEEDSDOC @param encoding
1161    */
setInputEncoding(String encoding)1162   public void setInputEncoding(String encoding)
1163   {
1164     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1165   }
1166 
1167   /**
1168    * <p>Based on the <a
1169    * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1170    * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1171    * <p>
1172    * An attribute specifying whether errors checking is enforced or not.
1173    * When set to <code>false</code>, the implementation is free to not
1174    * test every possible error case normally defined on DOM operations,
1175    * and not raise any <code>DOMException</code>. In case of error, the
1176    * behavior is undefined. This attribute is <code>true</code> by
1177    * defaults.
1178    * @since DOM Level 3
1179    *
1180    * NEEDSDOC ($objectName$) @return
1181    */
getStrictErrorChecking()1182   public boolean getStrictErrorChecking()
1183   {
1184 
1185     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1186 
1187     return false;
1188   }
1189 
1190   /**
1191    * <p>Based on the <a
1192    * href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
1193    * Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
1194    * <p>
1195    * An attribute specifying whether errors checking is enforced or not.
1196    * When set to <code>false</code>, the implementation is free to not
1197    * test every possible error case normally defined on DOM operations,
1198    * and not raise any <code>DOMException</code>. In case of error, the
1199    * behavior is undefined. This attribute is <code>true</code> by
1200    * defaults.
1201    * @since DOM Level 3
1202    *
1203    * NEEDSDOC @param strictErrorChecking
1204    */
setStrictErrorChecking(boolean strictErrorChecking)1205   public void setStrictErrorChecking(boolean strictErrorChecking)
1206   {
1207     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1208   }
1209 
1210     // RAMESH : Pending proper implementation of DOM Level 3
setUserData(String key, Object data, UserDataHandler handler)1211     public Object setUserData(String key,
1212                               Object data,
1213                               UserDataHandler handler) {
1214         return getOwnerDocument().setUserData( key, data, handler);
1215     }
1216 
1217     /**
1218      * Retrieves the object associated to a key on a this node. The object
1219      * must first have been set to this node by calling
1220      * <code>setUserData</code> with the same key.
1221      * @param key The key the object is associated to.
1222      * @return Returns the <code>DOMObject</code> associated to the given key
1223      *   on this node, or <code>null</code> if there was none.
1224      * @since DOM Level 3
1225      */
getUserData(String key)1226     public Object getUserData(String key) {
1227         return getOwnerDocument().getUserData( key);
1228     }
1229 
1230       /**
1231      *  This method returns a specialized object which implements the
1232      * specialized APIs of the specified feature and version. The
1233      * specialized object may also be obtained by using binding-specific
1234      * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
1235      * @param feature The name of the feature requested (case-insensitive).
1236      * @param version  This is the version number of the feature to test. If
1237      *   the version is <code>null</code> or the empty string, supporting
1238      *   any version of the feature will cause the method to return an
1239      *   object that supports at least one version of the feature.
1240      * @return  Returns an object which implements the specialized APIs of
1241      *   the specified feature and version, if any, or <code>null</code> if
1242      *   there is no object which implements interfaces associated with that
1243      *   feature. If the <code>DOMObject</code> returned by this method
1244      *   implements the <code>Node</code> interface, it must delegate to the
1245      *   primary core <code>Node</code> and not return results inconsistent
1246      *   with the primary core <code>Node</code> such as attributes,
1247      *   childNodes, etc.
1248      * @since DOM Level 3
1249      */
getFeature(String feature, String version)1250     public Object getFeature(String feature, String version) {
1251         // we don't have any alternate node, either this node does the job
1252         // or we don't have anything that does
1253         return isSupported(feature, version) ? this : null;
1254     }
1255 
1256     /**
1257      * Tests whether two nodes are equal.
1258      * <br>This method tests for equality of nodes, not sameness (i.e.,
1259      * whether the two nodes are references to the same object) which can be
1260      * tested with <code>Node.isSameNode</code>. All nodes that are the same
1261      * will also be equal, though the reverse may not be true.
1262      * <br>Two nodes are equal if and only if the following conditions are
1263      * satisfied: The two nodes are of the same type.The following string
1264      * attributes are equal: <code>nodeName</code>, <code>localName</code>,
1265      * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
1266      * , <code>baseURI</code>. This is: they are both <code>null</code>, or
1267      * they have the same length and are character for character identical.
1268      * The <code>attributes</code> <code>NamedNodeMaps</code> are equal.
1269      * This is: they are both <code>null</code>, or they have the same
1270      * length and for each node that exists in one map there is a node that
1271      * exists in the other map and is equal, although not necessarily at the
1272      * same index.The <code>childNodes</code> <code>NodeLists</code> are
1273      * equal. This is: they are both <code>null</code>, or they have the
1274      * same length and contain equal nodes at the same index. This is true
1275      * for <code>Attr</code> nodes as for any other type of node. Note that
1276      * normalization can affect equality; to avoid this, nodes should be
1277      * normalized before being compared.
1278      * <br>For two <code>DocumentType</code> nodes to be equal, the following
1279      * conditions must also be satisfied: The following string attributes
1280      * are equal: <code>publicId</code>, <code>systemId</code>,
1281      * <code>internalSubset</code>.The <code>entities</code>
1282      * <code>NamedNodeMaps</code> are equal.The <code>notations</code>
1283      * <code>NamedNodeMaps</code> are equal.
1284      * <br>On the other hand, the following do not affect equality: the
1285      * <code>ownerDocument</code> attribute, the <code>specified</code>
1286      * attribute for <code>Attr</code> nodes, the
1287      * <code>isWhitespaceInElementContent</code> attribute for
1288      * <code>Text</code> nodes, as well as any user data or event listeners
1289      * registered on the nodes.
1290      * @param arg The node to compare equality with.
1291      * @param deep If <code>true</code>, recursively compare the subtrees; if
1292      *   <code>false</code>, compare only the nodes themselves (and its
1293      *   attributes, if it is an <code>Element</code>).
1294      * @return If the nodes, and possibly subtrees are equal,
1295      *   <code>true</code> otherwise <code>false</code>.
1296      * @since DOM Level 3
1297      */
isEqualNode(Node arg)1298     public boolean isEqualNode(Node arg) {
1299         if (arg == this) {
1300             return true;
1301         }
1302         if (arg.getNodeType() != getNodeType()) {
1303             return false;
1304         }
1305         // in theory nodeName can't be null but better be careful
1306         // who knows what other implementations may be doing?...
1307         if (getNodeName() == null) {
1308             if (arg.getNodeName() != null) {
1309                 return false;
1310             }
1311         }
1312         else if (!getNodeName().equals(arg.getNodeName())) {
1313             return false;
1314         }
1315 
1316         if (getLocalName() == null) {
1317             if (arg.getLocalName() != null) {
1318                 return false;
1319             }
1320         }
1321         else if (!getLocalName().equals(arg.getLocalName())) {
1322             return false;
1323         }
1324 
1325         if (getNamespaceURI() == null) {
1326             if (arg.getNamespaceURI() != null) {
1327                 return false;
1328             }
1329         }
1330         else if (!getNamespaceURI().equals(arg.getNamespaceURI())) {
1331             return false;
1332         }
1333 
1334         if (getPrefix() == null) {
1335             if (arg.getPrefix() != null) {
1336                 return false;
1337             }
1338         }
1339         else if (!getPrefix().equals(arg.getPrefix())) {
1340             return false;
1341         }
1342 
1343         if (getNodeValue() == null) {
1344             if (arg.getNodeValue() != null) {
1345                 return false;
1346             }
1347         }
1348         else if (!getNodeValue().equals(arg.getNodeValue())) {
1349             return false;
1350         }
1351     /*
1352         if (getBaseURI() == null) {
1353             if (((NodeImpl) arg).getBaseURI() != null) {
1354                 return false;
1355             }
1356         }
1357         else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
1358             return false;
1359         }
1360 */
1361 
1362              return true;
1363     }
1364 
1365     /**
1366      * DOM Level 3:
1367      * Look up the namespace URI associated to the given prefix, starting from this node.
1368      * Use lookupNamespaceURI(null) to lookup the default namespace
1369      *
1370      * @param namespaceURI
1371      * @return th URI for the namespace
1372      * @since DOM Level 3
1373      */
lookupNamespaceURI(String specifiedPrefix)1374     public String lookupNamespaceURI(String specifiedPrefix) {
1375         short type = this.getNodeType();
1376         switch (type) {
1377         case Node.ELEMENT_NODE : {
1378 
1379                 String namespace = this.getNamespaceURI();
1380                 String prefix = this.getPrefix();
1381                 if (namespace !=null) {
1382                     // REVISIT: is it possible that prefix is empty string?
1383                     if (specifiedPrefix== null && prefix==specifiedPrefix) {
1384                         // looking for default namespace
1385                         return namespace;
1386                     } else if (prefix != null && prefix.equals(specifiedPrefix)) {
1387                         // non default namespace
1388                         return namespace;
1389                     }
1390                 }
1391                 if (this.hasAttributes()) {
1392                     NamedNodeMap map = this.getAttributes();
1393                     int length = map.getLength();
1394                     for (int i=0;i<length;i++) {
1395                         Node attr = map.item(i);
1396                         String attrPrefix = attr.getPrefix();
1397                         String value = attr.getNodeValue();
1398                         namespace = attr.getNamespaceURI();
1399                         if (namespace !=null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
1400                             // at this point we are dealing with DOM Level 2 nodes only
1401                             if (specifiedPrefix == null &&
1402                                 attr.getNodeName().equals("xmlns")) {
1403                                 // default namespace
1404                                 return value;
1405                             } else if (attrPrefix !=null &&
1406                                        attrPrefix.equals("xmlns") &&
1407                                        attr.getLocalName().equals(specifiedPrefix)) {
1408                  // non default namespace
1409                                 return value;
1410                             }
1411                         }
1412                     }
1413                 }
1414 		/*
1415                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1416                 if (ancestor != null) {
1417                     return ancestor.lookupNamespaceURI(specifiedPrefix);
1418                 }
1419 		*/
1420 
1421                 return null;
1422 
1423 
1424             }
1425 /*
1426         case Node.DOCUMENT_NODE : {
1427                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
1428             }
1429 */
1430         case Node.ENTITY_NODE :
1431         case Node.NOTATION_NODE:
1432         case Node.DOCUMENT_FRAGMENT_NODE:
1433         case Node.DOCUMENT_TYPE_NODE:
1434             // type is unknown
1435             return null;
1436         case Node.ATTRIBUTE_NODE:{
1437                 if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
1438                     return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
1439 
1440                 }
1441                 return null;
1442             }
1443         default:{
1444 	   /*
1445                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1446                 if (ancestor != null) {
1447                     return ancestor.lookupNamespaceURI(specifiedPrefix);
1448                 }
1449              */
1450                 return null;
1451             }
1452 
1453         }
1454     }
1455 
1456     /**
1457      *  DOM Level 3:
1458      *  This method checks if the specified <code>namespaceURI</code> is the
1459      *  default namespace or not.
1460      *  @param namespaceURI The namespace URI to look for.
1461      *  @return  <code>true</code> if the specified <code>namespaceURI</code>
1462      *   is the default namespace, <code>false</code> otherwise.
1463      * @since DOM Level 3
1464      */
isDefaultNamespace(String namespaceURI)1465     public boolean isDefaultNamespace(String namespaceURI){
1466        /*
1467         // REVISIT: remove casts when DOM L3 becomes REC.
1468         short type = this.getNodeType();
1469         switch (type) {
1470         case Node.ELEMENT_NODE: {
1471             String namespace = this.getNamespaceURI();
1472             String prefix = this.getPrefix();
1473 
1474             // REVISIT: is it possible that prefix is empty string?
1475             if (prefix == null || prefix.length() == 0) {
1476                 if (namespaceURI == null) {
1477                     return (namespace == namespaceURI);
1478                 }
1479                 return namespaceURI.equals(namespace);
1480             }
1481             if (this.hasAttributes()) {
1482                 ElementImpl elem = (ElementImpl)this;
1483                 NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns");
1484                 if (attr != null) {
1485                     String value = attr.getNodeValue();
1486                     if (namespaceURI == null) {
1487                         return (namespace == value);
1488                     }
1489                     return namespaceURI.equals(value);
1490                 }
1491             }
1492 
1493             NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1494             if (ancestor != null) {
1495                 return ancestor.isDefaultNamespace(namespaceURI);
1496             }
1497             return false;
1498         }
1499         case Node.DOCUMENT_NODE:{
1500                 return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI);
1501             }
1502 
1503         case Node.ENTITY_NODE :
1504           case Node.NOTATION_NODE:
1505         case Node.DOCUMENT_FRAGMENT_NODE:
1506         case Node.DOCUMENT_TYPE_NODE:
1507             // type is unknown
1508             return false;
1509         case Node.ATTRIBUTE_NODE:{
1510                 if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
1511                     return ownerNode.isDefaultNamespace(namespaceURI);
1512 
1513                 }
1514                 return false;
1515             }
1516         default:{
1517                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1518                 if (ancestor != null) {
1519                     return ancestor.isDefaultNamespace(namespaceURI);
1520                 }
1521                 return false;
1522             }
1523 
1524         }
1525 */
1526         return false;
1527 
1528 
1529     }
1530 
1531     /**
1532      *
1533      * DOM Level 3:
1534      * Look up the prefix associated to the given namespace URI, starting from this node.
1535      *
1536      * @param namespaceURI
1537      * @return the prefix for the namespace
1538      */
lookupPrefix(String namespaceURI)1539     public String lookupPrefix(String namespaceURI){
1540 
1541         // REVISIT: When Namespaces 1.1 comes out this may not be true
1542         // Prefix can't be bound to null namespace
1543         if (namespaceURI == null) {
1544             return null;
1545         }
1546 
1547         short type = this.getNodeType();
1548 
1549         switch (type) {
1550 /*
1551         case Node.ELEMENT_NODE: {
1552 
1553                 String namespace = this.getNamespaceURI(); // to flip out children
1554                 return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
1555             }
1556 
1557         case Node.DOCUMENT_NODE:{
1558                 return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
1559             }
1560 */
1561         case Node.ENTITY_NODE :
1562         case Node.NOTATION_NODE:
1563         case Node.DOCUMENT_FRAGMENT_NODE:
1564         case Node.DOCUMENT_TYPE_NODE:
1565             // type is unknown
1566             return null;
1567         case Node.ATTRIBUTE_NODE:{
1568                 if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
1569                     return getOwnerElement().lookupPrefix(namespaceURI);
1570 
1571                 }
1572                 return null;
1573             }
1574         default:{
1575 /*
1576                 NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1577                 if (ancestor != null) {
1578                     return ancestor.lookupPrefix(namespaceURI);
1579                 }
1580 */
1581                 return null;
1582             }
1583          }
1584     }
1585 
1586     /**
1587      * Returns whether this node is the same node as the given one.
1588      * <br>This method provides a way to determine whether two
1589      * <code>Node</code> references returned by the implementation reference
1590      * the same object. When two <code>Node</code> references are references
1591      * to the same object, even if through a proxy, the references may be
1592      * used completely interchangably, such that all attributes have the
1593      * same values and calling the same DOM method on either reference
1594      * always has exactly the same effect.
1595      * @param other The node to test against.
1596      * @return Returns <code>true</code> if the nodes are the same,
1597      *   <code>false</code> otherwise.
1598      * @since DOM Level 3
1599      */
isSameNode(Node other)1600     public boolean isSameNode(Node other) {
1601         // we do not use any wrapper so the answer is obvious
1602         return this == other;
1603     }
1604 
1605     /**
1606      * This attribute returns the text content of this node and its
1607      * descendants. When it is defined to be null, setting it has no effect.
1608      * When set, any possible children this node may have are removed and
1609      * replaced by a single <code>Text</code> node containing the string
1610      * this attribute is set to. On getting, no serialization is performed,
1611      * the returned string does not contain any markup. No whitespace
1612      * normalization is performed, the returned string does not contain the
1613      * element content whitespaces . Similarly, on setting, no parsing is
1614      * performed either, the input string is taken as pure textual content.
1615      * <br>The string returned is made of the text content of this node
1616      * depending on its type, as defined below:
1617      * <table border='1'>
1618      * <tr>
1619      * <th>Node type</th>
1620      * <th>Content</th>
1621      * </tr>
1622      * <tr>
1623      * <td valign='top' rowspan='1' colspan='1'>
1624      * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
1625      * DOCUMENT_FRAGMENT_NODE</td>
1626      * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
1627      * attribute value of every child node, excluding COMMENT_NODE and
1628      * PROCESSING_INSTRUCTION_NODE nodes</td>
1629      * </tr>
1630      * <tr>
1631      * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
1632      * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
1633      * <td valign='top' rowspan='1' colspan='1'>
1634      * <code>nodeValue</code></td>
1635      * </tr>
1636      * <tr>
1637      * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
1638      * <td valign='top' rowspan='1' colspan='1'>
1639      * null</td>
1640      * </tr>
1641      * </table>
1642      * @exception DOMException
1643      *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
1644      * @exception DOMException
1645      *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
1646      *   fit in a <code>DOMString</code> variable on the implementation
1647      *   platform.
1648      * @since DOM Level 3
1649      */
setTextContent(String textContent)1650     public void setTextContent(String textContent)
1651         throws DOMException {
1652         setNodeValue(textContent);
1653     }
1654 
1655     /**
1656      * This attribute returns the text content of this node and its
1657      * descendants. When it is defined to be null, setting it has no effect.
1658      * When set, any possible children this node may have are removed and
1659      * replaced by a single <code>Text</code> node containing the string
1660      * this attribute is set to. On getting, no serialization is performed,
1661      * the returned string does not contain any markup. No whitespace
1662      * normalization is performed, the returned string does not contain the
1663      * element content whitespaces . Similarly, on setting, no parsing is
1664      * performed either, the input string is taken as pure textual content.
1665      * <br>The string returned is made of the text content of this node
1666      * depending on its type, as defined below:
1667      * <table border='1'>
1668      * <tr>
1669      * <th>Node type</th>
1670      * <th>Content</th>
1671      * </tr>
1672      * <tr>
1673      * <td valign='top' rowspan='1' colspan='1'>
1674      * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
1675      * DOCUMENT_FRAGMENT_NODE</td>
1676      * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
1677      * attribute value of every child node, excluding COMMENT_NODE and
1678      * PROCESSING_INSTRUCTION_NODE nodes</td>
1679      * </tr>
1680      * <tr>
1681      * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
1682      * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
1683      * <td valign='top' rowspan='1' colspan='1'>
1684      * <code>nodeValue</code></td>
1685      * </tr>
1686      * <tr>
1687      * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
1688      * <td valign='top' rowspan='1' colspan='1'>
1689      * null</td>
1690      * </tr>
1691      * </table>
1692      * @exception DOMException
1693      *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
1694      * @exception DOMException
1695      *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
1696      *   fit in a <code>DOMString</code> variable on the implementation
1697      *   platform.
1698      * @since DOM Level 3
1699      */
getTextContent()1700     public String getTextContent() throws DOMException {
1701         return getNodeValue();  // overriden in some subclasses
1702     }
1703 
1704     /**
1705      * Compares a node with this node with regard to their position in the
1706      * document.
1707      * @param other The node to compare against this node.
1708      * @return Returns how the given node is positioned relatively to this
1709      *   node.
1710      * @since DOM Level 3
1711      */
compareDocumentPosition(Node other)1712     public short compareDocumentPosition(Node other) throws DOMException {
1713         return 0;
1714     }
1715 
1716     /**
1717      * The absolute base URI of this node or <code>null</code> if undefined.
1718      * This value is computed according to . However, when the
1719      * <code>Document</code> supports the feature "HTML" , the base URI is
1720      * computed using first the value of the href attribute of the HTML BASE
1721      * element if any, and the value of the <code>documentURI</code>
1722      * attribute from the <code>Document</code> interface otherwise.
1723      * <br> When the node is an <code>Element</code>, a <code>Document</code>
1724      * or a a <code>ProcessingInstruction</code>, this attribute represents
1725      * the properties [base URI] defined in . When the node is a
1726      * <code>Notation</code>, an <code>Entity</code>, or an
1727      * <code>EntityReference</code>, this attribute represents the
1728      * properties [declaration base URI] in the . How will this be affected
1729      * by resolution of relative namespace URIs issue?It's not.Should this
1730      * only be on Document, Element, ProcessingInstruction, Entity, and
1731      * Notation nodes, according to the infoset? If not, what is it equal to
1732      * on other nodes? Null? An empty string? I think it should be the
1733      * parent's.No.Should this be read-only and computed or and actual
1734      * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
1735      * teleconference 30 May 2001).If the base HTML element is not yet
1736      * attached to a document, does the insert change the Document.baseURI?
1737      * Yes. (F2F 26 Sep 2001)
1738      * @since DOM Level 3
1739      */
getBaseURI()1740     public String getBaseURI() {
1741         return null;
1742     }
1743 
1744     /**
1745      * DOM Level 3
1746      * Renaming node
1747      */
renameNode(Node n, String namespaceURI, String name)1748     public Node renameNode(Node n,
1749                            String namespaceURI,
1750                            String name)
1751                            throws DOMException{
1752         return n;
1753     }
1754 
1755     /**
1756      *  DOM Level 3
1757      *  Normalize document.
1758      */
normalizeDocument()1759     public void normalizeDocument(){
1760 
1761     }
1762 
1763     /**
1764      *  The configuration used when <code>Document.normalizeDocument</code> is
1765      * invoked.
1766      * @since DOM Level 3
1767      */
getDomConfig()1768     public DOMConfiguration getDomConfig(){
1769        return null;
1770     }
1771 
1772 
1773     /** DOM Level 3 feature: documentURI */
1774     protected String fDocumentURI;
1775 
1776     /**
1777      * DOM Level 3
1778      */
setDocumentURI(String documentURI)1779     public void setDocumentURI(String documentURI){
1780 
1781         fDocumentURI= documentURI;
1782     }
1783 
1784     /**
1785      * DOM Level 3
1786      * The location of the document or <code>null</code> if undefined.
1787      * <br>Beware that when the <code>Document</code> supports the feature
1788      * "HTML" , the href attribute of the HTML BASE element takes precedence
1789      * over this attribute.
1790      * @since DOM Level 3
1791      */
getDocumentURI()1792     public String getDocumentURI(){
1793         return fDocumentURI;
1794     }
1795 
1796     /** DOM Level 3 feature: Document actualEncoding */
1797     protected String actualEncoding;
1798 
1799     /**
1800      * DOM Level 3
1801      * An attribute specifying the actual encoding of this document. This is
1802      * <code>null</code> otherwise.
1803      * <br> This attribute represents the property [character encoding scheme]
1804      * defined in .
1805      * @since DOM Level 3
1806      */
getActualEncoding()1807     public String getActualEncoding() {
1808         return actualEncoding;
1809     }
1810 
1811     /**
1812      * DOM Level 3
1813      * An attribute specifying the actual encoding of this document. This is
1814      * <code>null</code> otherwise.
1815      * <br> This attribute represents the property [character encoding scheme]
1816      * defined in .
1817      * @since DOM Level 3
1818      */
setActualEncoding(String value)1819     public void setActualEncoding(String value) {
1820         actualEncoding = value;
1821     }
1822 
1823     /**
1824      * DOM Level 3
1825      */
replaceWholeText(String content)1826     public Text replaceWholeText(String content)
1827                                  throws DOMException{
1828 /*
1829 
1830         if (needsSyncData()) {
1831             synchronizeData();
1832         }
1833 
1834         // make sure we can make the replacement
1835         if (!canModify(nextSibling)) {
1836             throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
1837                 DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null));
1838         }
1839 
1840         Node parent = this.getParentNode();
1841         if (content == null || content.length() == 0) {
1842             // remove current node
1843             if (parent !=null) { // check if node in the tree
1844                 parent.removeChild(this);
1845                 return null;
1846             }
1847         }
1848         Text currentNode = null;
1849         if (isReadOnly()){
1850             Text newNode = this.ownerDocument().createTextNode(content);
1851             if (parent !=null) { // check if node in the tree
1852                 parent.insertBefore(newNode, this);
1853                 parent.removeChild(this);
1854                 currentNode = newNode;
1855             } else {
1856                 return newNode;
1857             }
1858         }  else {
1859             this.setData(content);
1860             currentNode = this;
1861         }
1862         Node sibling =  currentNode.getNextSibling();
1863         while ( sibling !=null) {
1864             parent.removeChild(sibling);
1865             sibling = currentNode.getNextSibling();
1866         }
1867 
1868         return currentNode;
1869 */
1870         return null; //Pending
1871     }
1872 
1873     /**
1874      * DOM Level 3
1875      * Returns all text of <code>Text</code> nodes logically-adjacent text
1876      * nodes to this node, concatenated in document order.
1877      * @since DOM Level 3
1878      */
getWholeText()1879     public String getWholeText(){
1880 
1881 /*
1882         if (needsSyncData()) {
1883             synchronizeData();
1884         }
1885         if (nextSibling == null) {
1886             return data;
1887         }
1888         StringBuffer buffer = new StringBuffer();
1889         if (data != null && data.length() != 0) {
1890             buffer.append(data);
1891         }
1892         getWholeText(nextSibling, buffer);
1893         return buffer.toString();
1894 */
1895         return null; // PENDING
1896 
1897     }
1898 
1899     /**
1900      * DOM Level 3
1901      * Returns whether this text node contains whitespace in element content,
1902      * often abusively called "ignorable whitespace".
1903      */
isWhitespaceInElementContent()1904     public boolean isWhitespaceInElementContent(){
1905         return false;
1906     }
1907 
1908     /**
1909      * NON-DOM: set the type of this attribute to be ID type.
1910      *
1911      * @param id
1912      */
setIdAttribute(boolean id)1913     public void setIdAttribute(boolean id){
1914         //PENDING
1915     }
1916 
1917     /**
1918      * DOM Level 3: register the given attribute node as an ID attribute
1919      */
setIdAttribute(String name, boolean makeId)1920     public void setIdAttribute(String name, boolean makeId) {
1921         //PENDING
1922     }
1923 
1924     /**
1925      * DOM Level 3: register the given attribute node as an ID attribute
1926      */
setIdAttributeNode(Attr at, boolean makeId)1927     public void setIdAttributeNode(Attr at, boolean makeId) {
1928         //PENDING
1929     }
1930 
1931     /**
1932      * DOM Level 3: register the given attribute node as an ID attribute
1933      */
setIdAttributeNS(String namespaceURI, String localName, boolean makeId)1934     public void setIdAttributeNS(String namespaceURI, String localName,
1935                                     boolean makeId) {
1936         //PENDING
1937     }
1938 
1939     /**
1940      * Method getSchemaTypeInfo.
1941      * @return TypeInfo
1942      */
getSchemaTypeInfo()1943     public TypeInfo getSchemaTypeInfo(){
1944         return null; //PENDING
1945     }
1946 
isId()1947     public boolean isId() {
1948         return false; //PENDING
1949     }
1950 
1951     private String xmlEncoding;
getXmlEncoding( )1952     public String getXmlEncoding ( ) {
1953         return xmlEncoding;
1954     }
setXmlEncoding( String xmlEncoding )1955     public void setXmlEncoding ( String xmlEncoding ) {
1956         this.xmlEncoding = xmlEncoding;
1957     }
1958 
1959     private boolean xmlStandalone;
getXmlStandalone()1960     public boolean getXmlStandalone() {
1961         return xmlStandalone;
1962     }
1963 
setXmlStandalone(boolean xmlStandalone)1964     public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
1965         this.xmlStandalone = xmlStandalone;
1966     }
1967 
1968     private String xmlVersion;
getXmlVersion()1969     public String getXmlVersion() {
1970         return xmlVersion;
1971     }
1972 
setXmlVersion(String xmlVersion)1973     public void setXmlVersion(String xmlVersion) throws DOMException {
1974         this.xmlVersion = xmlVersion;
1975     }
1976 
1977 }
1978