KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > utils > UnImplNode


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: UnImplNode.java,v
18  */

19 package com.sun.org.apache.xml.internal.utils;
20
21 import com.sun.org.apache.xml.internal.res.XMLErrorResources;
22 import com.sun.org.apache.xml.internal.res.XMLMessages;
23
24 import org.w3c.dom.Attr JavaDoc;
25 import org.w3c.dom.CDATASection JavaDoc;
26 import org.w3c.dom.Comment JavaDoc;
27 import org.w3c.dom.DOMException JavaDoc;
28 import org.w3c.dom.DOMImplementation JavaDoc;
29 import org.w3c.dom.Document JavaDoc;
30 import org.w3c.dom.DocumentFragment JavaDoc;
31 import org.w3c.dom.DocumentType JavaDoc;
32 import org.w3c.dom.Element JavaDoc;
33 import org.w3c.dom.EntityReference JavaDoc;
34 import org.w3c.dom.NamedNodeMap JavaDoc;
35 import org.w3c.dom.Node JavaDoc;
36 import org.w3c.dom.NodeList JavaDoc;
37 import org.w3c.dom.ProcessingInstruction JavaDoc;
38 import org.w3c.dom.Text JavaDoc;
39
40 import org.w3c.dom.UserDataHandler JavaDoc;
41 import org.w3c.dom.DOMConfiguration JavaDoc;
42 import org.w3c.dom.TypeInfo JavaDoc;
43 /**
44  * <meta name="usage" content="internal"/>
45  * To be subclassed by classes that wish to fake being nodes.
46  */

47 public class UnImplNode implements Node JavaDoc, Element JavaDoc, NodeList JavaDoc, Document JavaDoc
48 {
49
50   /**
51    * Constructor UnImplNode
52    *
53    */

54   public UnImplNode(){}
55
56   /**
57    * Throw an error.
58    *
59    * @param msg Message Key for the error
60    */

61   public void error(String JavaDoc msg)
62   {
63
64     System.out.println("DOM ERROR! class: " + this.getClass().getName());
65
66     throw new RuntimeException JavaDoc(XMLMessages.createXMLMessage(msg, null));
67   }
68
69   /**
70    * Throw an error.
71    *
72    * @param msg Message Key for the error
73    * @param args Array of arguments to be used in the error message
74    */

75   public void error(String JavaDoc msg, Object JavaDoc[] args)
76   {
77
78     System.out.println("DOM ERROR! class: " + this.getClass().getName());
79
80     throw new RuntimeException JavaDoc(XMLMessages.createXMLMessage(msg, args)); //"UnImplNode error: "+msg);
81
}
82
83   /**
84    * Unimplemented. See org.w3c.dom.Node
85    *
86    * @param newChild New node to append to the list of this node's children
87    *
88    * @return null
89    *
90    * @throws DOMException
91    */

92   public Node JavaDoc appendChild(Node JavaDoc newChild) throws DOMException JavaDoc
93   {
94
95     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"appendChild not supported!");
96

97     return null;
98   }
99
100   /**
101    * Unimplemented. See org.w3c.dom.Node
102    *
103    * @return false
104    */

105   public boolean hasChildNodes()
106   {
107
108     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasChildNodes not supported!");
109

110     return false;
111   }
112
113   /**
114    * Unimplemented. See org.w3c.dom.Node
115    *
116    * @return 0
117    */

118   public short getNodeType()
119   {
120
121     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeType not supported!");
122

123     return 0;
124   }
125
126   /**
127    * Unimplemented. See org.w3c.dom.Node
128    *
129    * @return null
130    */

131   public Node JavaDoc getParentNode()
132   {
133
134     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getParentNode not supported!");
135

136     return null;
137   }
138
139   /**
140    * Unimplemented. See org.w3c.dom.Node
141    *
142    * @return null
143    */

144   public NodeList JavaDoc getChildNodes()
145   {
146
147     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getChildNodes not supported!");
148

149     return null;
150   }
151
152   /**
153    * Unimplemented. See org.w3c.dom.Node
154    *
155    * @return null
156    */

157   public Node JavaDoc getFirstChild()
158   {
159
160     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getFirstChild not supported!");
161

162     return null;
163   }
164
165   /**
166    * Unimplemented. See org.w3c.dom.Node
167    *
168    * @return null
169    */

170   public Node JavaDoc getLastChild()
171   {
172
173     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLastChild not supported!");
174

175     return null;
176   }
177
178   /**
179    * Unimplemented. See org.w3c.dom.Node
180    *
181    * @return null
182    */

183   public Node JavaDoc getNextSibling()
184   {
185
186     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNextSibling not supported!");
187

188     return null;
189   }
190
191   /**
192    * Unimplemented. See org.w3c.dom.NodeList
193    *
194    * @return 0
195    */

196   public int getLength()
197   {
198
199     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLength not supported!");
200

201     return 0;
202   } // getLength():int
203

204   /**
205    * Unimplemented. See org.w3c.dom.NodeList
206    *
207    * @param index index of a child of this node in its list of children
208    *
209    * @return null
210    */

211   public Node JavaDoc item(int index)
212   {
213
214     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"item not supported!");
215

216     return null;
217   } // item(int):Node
218

219   /**
220    * Unimplemented. See org.w3c.dom.Node
221    *
222    * @return null
223    */

224   public Document JavaDoc getOwnerDocument()
225   {
226
227     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerDocument not supported!");
228

229     return null;
230   }
231
232   /**
233    * Unimplemented. See org.w3c.dom.Node
234    *
235    * @return null
236    */

237   public String JavaDoc getTagName()
238   {
239
240     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getTagName not supported!");
241

242     return null;
243   }
244
245   /**
246    * Unimplemented. See org.w3c.dom.Node
247    *
248    * @return null
249    */

250   public String JavaDoc getNodeName()
251   {
252
253     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeName not supported!");
254

255     return null;
256   }
257
258   /** Unimplemented. See org.w3c.dom.Node */
259   public void normalize()
260   {
261     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"normalize not supported!");
262
}
263
264   /**
265    * Unimplemented. See org.w3c.dom.Element
266    *
267    * @param name Name of the element
268    *
269    * @return null
270    */

271   public NodeList JavaDoc getElementsByTagName(String JavaDoc name)
272   {
273
274     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagName not supported!");
275

276     return null;
277   }
278
279   /**
280    * Unimplemented. See org.w3c.dom.Element
281    *
282    * @param oldAttr Attribute to be removed from this node's list of attributes
283    *
284    * @return null
285    *
286    * @throws DOMException
287    */

288   public Attr JavaDoc removeAttributeNode(Attr JavaDoc oldAttr) throws DOMException JavaDoc
289   {
290
291     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNode not supported!");
292

293     return null;
294   }
295
296   /**
297    * Unimplemented. See org.w3c.dom.Element
298    *
299    * @param newAttr Attribute node to be added to this node's list of attributes
300    *
301    * @return null
302    *
303    * @throws DOMException
304    */

305   public Attr JavaDoc setAttributeNode(Attr JavaDoc newAttr) throws DOMException JavaDoc
306   {
307
308     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNode not supported!");
309

310     return null;
311   }
312
313   /**
314    * Unimplemented. See org.w3c.dom.Element
315    *
316    *
317    * @param name Name of an attribute
318    *
319    * @return false
320    */

321   public boolean hasAttribute(String JavaDoc name)
322   {
323
324     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttribute not supported!");
325

326     return false;
327   }
328
329   /**
330    * Unimplemented. See org.w3c.dom.Element
331    *
332    *
333    * @param name
334    * @param x
335    *
336    * @return false
337    */

338   public boolean hasAttributeNS(String JavaDoc name, String JavaDoc x)
339   {
340
341     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributeNS not supported!");
342

343     return false;
344   }
345
346   /**
347    * Unimplemented. See org.w3c.dom.Element
348    *
349    *
350    * @param name Attribute node name
351    *
352    * @return null
353    */

354   public Attr JavaDoc getAttributeNode(String JavaDoc name)
355   {
356
357     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNode not supported!");
358

359     return null;
360   }
361
362   /**
363    * Unimplemented. See org.w3c.dom.Element
364    *
365    * @param name Attribute node name to remove from list of attributes
366    *
367    * @throws DOMException
368    */

369   public void removeAttribute(String JavaDoc name) throws DOMException JavaDoc
370   {
371     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttribute not supported!");
372
}
373
374   /**
375    * Unimplemented. See org.w3c.dom.Element
376    *
377    * @param name Name of attribute to set
378    * @param value Value of attribute
379    *
380    * @throws DOMException
381    */

382   public void setAttribute(String JavaDoc name, String JavaDoc value) throws DOMException JavaDoc
383   {
384     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttribute not supported!");
385
}
386
387   /**
388    * Unimplemented. See org.w3c.dom.Element
389    *
390    * @param name Name of attribute to get
391    *
392    * @return null
393    */

394   public String JavaDoc getAttribute(String JavaDoc name)
395   {
396
397     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttribute not supported!");
398

399     return null;
400   }
401
402   /**
403    * Unimplemented. Introduced in DOM Level 2.
404    *
405    * @return false
406    */

407   public boolean hasAttributes()
408   {
409
410     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributes not supported!");
411

412     return false;
413   }
414
415   /**
416    * Unimplemented. See org.w3c.dom.Element
417    *
418    * @param namespaceURI Namespace URI of the element
419    * @param localName Local part of qualified name of the element
420    *
421    * @return null
422    */

423   public NodeList JavaDoc getElementsByTagNameNS(String JavaDoc namespaceURI,
424                                          String JavaDoc localName)
425   {
426
427     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagNameNS not supported!");
428

429     return null;
430   }
431
432   /**
433    * Unimplemented. See org.w3c.dom.Element
434    *
435    * @param newAttr Attribute to set
436    *
437    * @return null
438    *
439    * @throws DOMException
440    */

441   public Attr JavaDoc setAttributeNodeNS(Attr JavaDoc newAttr) throws DOMException JavaDoc
442   {
443
444     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNodeNS not supported!");
445

446     return null;
447   }
448
449   /**
450    * Unimplemented. See org.w3c.dom.Element
451    *
452    * @param namespaceURI Namespace URI of attribute node to get
453    * @param localName Local part of qualified name of attribute node to get
454    *
455    * @return null
456    */

457   public Attr JavaDoc getAttributeNodeNS(String JavaDoc namespaceURI, String JavaDoc localName)
458   {
459
460     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNodeNS not supported!");
461

462     return null;
463   }
464
465   /**
466    * Unimplemented. See org.w3c.dom.Element
467    *
468    * @param namespaceURI Namespace URI of attribute node to remove
469    * @param localName Local part of qualified name of attribute node to remove
470    *
471    * @throws DOMException
472    */

473   public void removeAttributeNS(String JavaDoc namespaceURI, String JavaDoc localName)
474           throws DOMException JavaDoc
475   {
476     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNS not supported!");
477
}
478
479   /**
480    * Unimplemented. See org.w3c.dom.Element
481    *
482    * @param namespaceURI Namespace URI of attribute node to set
483    * @param localName Local part of qualified name of attribute node to set
484    * NEEDSDOC @param qualifiedName
485    * @param value value of attribute
486    *
487    * @throws DOMException
488    */

489   public void setAttributeNS(
490           String JavaDoc namespaceURI, String JavaDoc qualifiedName, String JavaDoc value)
491             throws DOMException JavaDoc
492   {
493     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNS not supported!");
494
}
495
496   /**
497    * Unimplemented. See org.w3c.dom.Element
498    *
499    * @param namespaceURI Namespace URI of attribute node to get
500    * @param localName Local part of qualified name of attribute node to get
501    *
502    * @return null
503    */

504   public String JavaDoc getAttributeNS(String JavaDoc namespaceURI, String JavaDoc localName)
505   {
506
507     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNS not supported!");
508

509     return null;
510   }
511
512   /**
513    * Unimplemented. See org.w3c.dom.Node
514    *
515    * @return null
516    */

517   public Node JavaDoc getPreviousSibling()
518   {
519
520     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPreviousSibling not supported!");
521

522     return null;
523   }
524
525   /**
526    * Unimplemented. See org.w3c.dom.Node
527    *
528    * @param deep Flag indicating whether to clone deep (clone member variables)
529    *
530    * @return null
531    */

532   public Node JavaDoc cloneNode(boolean deep)
533   {
534
535     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"cloneNode not supported!");
536

537     return null;
538   }
539
540   /**
541    * Unimplemented. See org.w3c.dom.Node
542    *
543    * @return null
544    *
545    * @throws DOMException
546    */

547   public String JavaDoc getNodeValue() throws DOMException JavaDoc
548   {
549
550     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeValue not supported!");
551

552     return null;
553   }
554
555   /**
556    * Unimplemented. See org.w3c.dom.Node
557    *
558    * @param nodeValue Value to set this node to
559    *
560    * @throws DOMException
561    */

562   public void setNodeValue(String JavaDoc nodeValue) throws DOMException JavaDoc
563   {
564     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setNodeValue not supported!");
565
}
566
567   /**
568    * Unimplemented. See org.w3c.dom.Node
569    *
570    *
571    * NEEDSDOC @param value
572    * @return value Node value
573    *
574    * @throws DOMException
575    */

576
577   // public String getValue ()
578
// {
579
// error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getValue not supported!");
580
// return null;
581
// }
582

583   /**
584    * Unimplemented. See org.w3c.dom.Node
585    *
586    * @param value Value to set this node to
587    *
588    * @throws DOMException
589    */

590   public void setValue(String JavaDoc value) throws DOMException JavaDoc
591   {
592     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!");
593
}
594
595   /**
596    * Returns the name of this attribute.
597    *
598    * @return the name of this attribute.
599    */

600
601   // public String getName()
602
// {
603
// return this.getNodeName();
604
// }
605

606   /**
607    * Unimplemented. See org.w3c.dom.Node
608    *
609    * @return null
610    */

611   public Element JavaDoc getOwnerElement()
612   {
613
614     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerElement not supported!");
615

616     return null;
617   }
618
619   /**
620    * Unimplemented. See org.w3c.dom.Node
621    *
622    * @return False
623    */

624   public boolean getSpecified()
625   {
626
627     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!");
628

629     return false;
630   }
631
632   /**
633    * Unimplemented. See org.w3c.dom.Node
634    *
635    * @return null
636    */

637   public NamedNodeMap JavaDoc getAttributes()
638   {
639
640     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributes not supported!");
641

642     return null;
643   }
644
645   /**
646    * Unimplemented. See org.w3c.dom.Node
647    *
648    * @param newChild New child node to insert
649    * @param refChild Insert in front of this child
650    *
651    * @return null
652    *
653    * @throws DOMException
654    */

655   public Node JavaDoc insertBefore(Node JavaDoc newChild, Node JavaDoc refChild) throws DOMException JavaDoc
656   {
657
658     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"insertBefore not supported!");
659

660     return null;
661   }
662
663   /**
664    * Unimplemented. See org.w3c.dom.Node
665    *
666    * @param newChild Replace existing child with this one
667    * @param oldChild Existing child to be replaced
668    *
669    * @return null
670    *
671    * @throws DOMException
672    */

673   public Node JavaDoc replaceChild(Node JavaDoc newChild, Node JavaDoc oldChild) throws DOMException JavaDoc
674   {
675
676     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
677

678     return null;
679   }
680
681   /**
682    * Unimplemented. See org.w3c.dom.Node
683    *
684    * @param oldChild Child to be removed
685    *
686    * @return null
687    *
688    * @throws DOMException
689    */

690   public Node JavaDoc removeChild(Node JavaDoc oldChild) throws DOMException JavaDoc
691   {
692
693     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
694

695     return null;
696   }
697
698   /**
699    * Tests whether the DOM implementation implements a specific feature and
700    * that feature is supported by this node.
701    * @param featureThe name of the feature to test. This is the same name
702    * which can be passed to the method <code>hasFeature</code> on
703    * <code>DOMImplementation</code>.
704    * @param versionThis is the version number of the feature to test. In
705    * Level 2, version 1, this is the string "2.0". If the version is not
706    * specified, supporting any version of the feature will cause the
707    * method to return <code>true</code>.
708    *
709    * NEEDSDOC @param feature
710    * NEEDSDOC @param version
711    * @return Returns <code>false</code>
712    * @since DOM Level 2
713    */

714   public boolean isSupported(String JavaDoc feature, String JavaDoc version)
715   {
716     return false;
717   }
718
719   /**
720    * Unimplemented. See org.w3c.dom.Node
721    *
722    * @return null
723    */

724   public String JavaDoc getNamespaceURI()
725   {
726
727     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNamespaceURI not supported!");
728

729     return null;
730   }
731
732   /**
733    * Unimplemented. See org.w3c.dom.Node
734    *
735    * @return null
736    */

737   public String JavaDoc getPrefix()
738   {
739
740     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPrefix not supported!");
741

742     return null;
743   }
744
745   /**
746    * Unimplemented. See org.w3c.dom.Node
747    *
748    * @param prefix Prefix to set for this node
749    *
750    * @throws DOMException
751    */

752   public void setPrefix(String JavaDoc prefix) throws DOMException JavaDoc
753   {
754     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setPrefix not supported!");
755
}
756
757   /**
758    * Unimplemented. See org.w3c.dom.Node
759    *
760    * @return null
761    */

762   public String JavaDoc getLocalName()
763   {
764
765     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLocalName not supported!");
766

767     return null;
768   }
769
770   /**
771    * Unimplemented. See org.w3c.dom.Document
772    *
773    * @return null
774    */

775   public DocumentType JavaDoc getDoctype()
776   {
777
778     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
779
780     return null;
781   }
782
783   /**
784    * Unimplemented. See org.w3c.dom.Document
785    *
786    * @return null
787    */

788   public DOMImplementation JavaDoc getImplementation()
789   {
790
791     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
792
793     return null;
794   }
795
796   /**
797    * Unimplemented. See org.w3c.dom.Document
798    *
799    * @return null
800    */

801   public Element JavaDoc getDocumentElement()
802   {
803
804     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
805
806     return null;
807   }
808
809   /**
810    * Unimplemented. See org.w3c.dom.Document
811    *
812    * @param tagName Element tag name
813    *
814    * @return null
815    *
816    * @throws DOMException
817    */

818   public Element JavaDoc createElement(String JavaDoc tagName) throws DOMException JavaDoc
819   {
820
821     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
822
823     return null;
824   }
825
826   /**
827    * Unimplemented. See org.w3c.dom.Document
828    *
829    * @return null
830    */

831   public DocumentFragment JavaDoc createDocumentFragment()
832   {
833
834     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
835
836     return null;
837   }
838
839   /**
840    * Unimplemented. See org.w3c.dom.Document
841    *
842    * @param data Data for text node
843    *
844    * @return null
845    */

846   public Text JavaDoc createTextNode(String JavaDoc data)
847   {
848
849     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
850
851     return null;
852   }
853
854   /**
855    * Unimplemented. See org.w3c.dom.Document
856    *
857    * @param data Data for comment
858    *
859    * @return null
860    */

861   public Comment JavaDoc createComment(String JavaDoc data)
862   {
863
864     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
865
866     return null;
867   }
868
869   /**
870    * Unimplemented. See org.w3c.dom.Document
871    *
872    * @param data Data for CDATA section
873    *
874    * @return null
875    *
876    * @throws DOMException
877    */

878   public CDATASection JavaDoc createCDATASection(String JavaDoc data) throws DOMException JavaDoc
879   {
880
881     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
882
883     return null;
884   }
885
886   /**
887    * Unimplemented. See org.w3c.dom.Document
888    *
889    * @param target Target for Processing instruction
890    * @param data Data for Processing instruction
891    *
892    * @return null
893    *
894    * @throws DOMException
895    */

896   public ProcessingInstruction JavaDoc createProcessingInstruction(
897           String JavaDoc target, String JavaDoc data) throws DOMException JavaDoc
898   {
899
900     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
901
902     return null;
903   }
904
905   /**
906    * Unimplemented. See org.w3c.dom.Document
907    *
908    * @param name Attribute name
909    *
910    * @return null
911    *
912    * @throws DOMException
913    */

914   public Attr JavaDoc createAttribute(String JavaDoc name) throws DOMException JavaDoc
915   {
916
917     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
918
919     return null;
920   }
921
922   /**
923    * Unimplemented. See org.w3c.dom.Document
924    *
925    * @param name Entity Reference name
926    *
927    * @return null
928    *
929    * @throws DOMException
930    */

931   public EntityReference JavaDoc createEntityReference(String JavaDoc name)
932           throws DOMException JavaDoc
933   {
934
935     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
936
937     return null;
938   }
939
940   /**
941    * Unimplemented. See org.w3c.dom.Document
942    *
943    * @param importedNodeThe node to import.
944    * @param deepIf <code>true</code>, recursively import the subtree under
945    * the specified node; if <code>false</code>, import only the node
946    * itself, as explained above. This has no effect on <code>Attr</code>
947    * , <code>EntityReference</code>, and <code>Notation</code> nodes.
948    *
949    * NEEDSDOC @param importedNode
950    * NEEDSDOC @param deep
951    *
952    * @return null
953    *
954    * @throws DOMException
955    */

956   public Node JavaDoc importNode(Node JavaDoc importedNode, boolean deep) throws DOMException JavaDoc
957   {
958
959     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
960
961     return null;
962   }
963
964   /**
965    * Unimplemented. See org.w3c.dom.Document
966    *
967    * @param namespaceURI Namespace URI for the element
968    * @param qualifiedName Qualified name of the element
969    *
970    * @return null
971    *
972    * @throws DOMException
973    */

974   public Element JavaDoc createElementNS(String JavaDoc namespaceURI, String JavaDoc qualifiedName)
975           throws DOMException JavaDoc
976   {
977
978     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
979
980     return null;
981   }
982
983   /**
984    * Unimplemented. See org.w3c.dom.Document
985    *
986    * @param namespaceURI Namespace URI of the attribute
987    * @param qualifiedName Qualified name of the attribute
988    *
989    * @return null
990    *
991    * @throws DOMException
992    */

993   public Attr JavaDoc createAttributeNS(String JavaDoc namespaceURI, String JavaDoc qualifiedName)
994           throws DOMException JavaDoc
995   {
996
997     error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
998
999     return null;
1000  }
1001
1002  /**
1003   * Unimplemented. See org.w3c.dom.Document
1004   *
1005   * @param elementId ID of the element to get
1006   *
1007   * @return null
1008   */

1009  public Element JavaDoc getElementById(String JavaDoc elementId)
1010  {
1011
1012    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1013
1014    return null;
1015  }
1016
1017  /**
1018   * Set Node data
1019   *
1020   *
1021   * @param data data to set for this node
1022   *
1023   * @throws DOMException
1024   */

1025  public void setData(String JavaDoc data) throws DOMException JavaDoc
1026  {
1027    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1028  }
1029
1030  /**
1031   * Unimplemented.
1032   *
1033   * @param offset Start offset of substring to extract.
1034   * @param count The length of the substring to extract.
1035   *
1036   * @return null
1037   *
1038   * @throws DOMException
1039   */

1040  public String JavaDoc substringData(int offset, int count) throws DOMException JavaDoc
1041  {
1042
1043    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1044
1045    return null;
1046  }
1047
1048  /**
1049   * Unimplemented.
1050   *
1051   * @param arg String data to append
1052   *
1053   * @throws DOMException
1054   */

1055  public void appendData(String JavaDoc arg) throws DOMException JavaDoc
1056  {
1057    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1058  }
1059
1060  /**
1061   * Unimplemented.
1062   *
1063   * @param offset Start offset of substring to insert.
1064   * @param count The length of the substring to insert.
1065   * NEEDSDOC @param arg
1066   *
1067   * @throws DOMException
1068   */

1069  public void insertData(int offset, String JavaDoc arg) throws DOMException JavaDoc
1070  {
1071    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1072  }
1073
1074  /**
1075   * Unimplemented.
1076   *
1077   * @param offset Start offset of substring to delete.
1078   * @param count The length of the substring to delete.
1079   *
1080   * @throws DOMException
1081   */

1082  public void deleteData(int offset, int count) throws DOMException JavaDoc
1083  {
1084    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1085  }
1086
1087  /**
1088   * Unimplemented.
1089   *
1090   * @param offset Start offset of substring to replace.
1091   * @param count The length of the substring to replace.
1092   * @param arg substring to replace with
1093   *
1094   * @throws DOMException
1095   */

1096  public void replaceData(int offset, int count, String JavaDoc arg)
1097          throws DOMException JavaDoc
1098  {
1099    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1100  }
1101
1102  /**
1103   * Unimplemented.
1104   *
1105   * @param offset Offset into text to split
1106   *
1107   * @return null, unimplemented
1108   *
1109   * @throws DOMException
1110   */

1111  public Text JavaDoc splitText(int offset) throws DOMException JavaDoc
1112  {
1113
1114    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1115
1116    return null;
1117  }
1118
1119  /**
1120   * NEEDSDOC Method adoptNode
1121   *
1122   *
1123   * NEEDSDOC @param source
1124   *
1125   * NEEDSDOC (adoptNode) @return
1126   *
1127   * @throws DOMException
1128   */

1129  public Node JavaDoc adoptNode(Node JavaDoc source) throws DOMException JavaDoc
1130  {
1131
1132    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1133
1134    return null;
1135  }
1136
1137  /**
1138   * <p>EXPERIMENTAL! Based on the <a
1139   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1140   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1141   * <p>
1142   * An attribute specifying, as part of the XML declaration, the encoding
1143   * of this document. This is <code>null</code> when unspecified.
1144   * @since DOM Level 3
1145   *
1146   * NEEDSDOC ($objectName$) @return
1147   */

1148  public String JavaDoc getInputEncoding()
1149  {
1150
1151    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1152
1153    return null;
1154  }
1155
1156  /**
1157   * <p>EXPERIMENTAL! Based on the <a
1158   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1159   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1160   * <p>
1161   * An attribute specifying, as part of the XML declaration, the encoding
1162   * of this document. This is <code>null</code> when unspecified.
1163   * @since DOM Level 3
1164   *
1165   * NEEDSDOC @param encoding
1166   */

1167  public void setInputEncoding(String JavaDoc encoding)
1168  {
1169    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1170  }
1171
1172  /**
1173   * <p>EXPERIMENTAL! Based on the <a
1174   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1175   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1176   * <p>
1177   * An attribute specifying, as part of the XML declaration, whether this
1178   * document is standalone.
1179   * @since DOM Level 3
1180   *
1181   * NEEDSDOC ($objectName$) @return
1182   */

1183  public boolean getStandalone()
1184  {
1185
1186    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1187
1188    return false;
1189  }
1190
1191  /**
1192   * <p>EXPERIMENTAL! Based on the <a
1193   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1194   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1195   * <p>
1196   * An attribute specifying, as part of the XML declaration, whether this
1197   * document is standalone.
1198   * @since DOM Level 3
1199   *
1200   * NEEDSDOC @param standalone
1201   */

1202  public void setStandalone(boolean standalone)
1203  {
1204    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1205  }
1206
1207  /**
1208   * <p>EXPERIMENTAL! Based on the <a
1209   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1210   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1211   * <p>
1212   * An attribute specifying whether errors checking is enforced or not.
1213   * When set to <code>false</code>, the implementation is free to not
1214   * test every possible error case normally defined on DOM operations,
1215   * and not raise any <code>DOMException</code>. In case of error, the
1216   * behavior is undefined. This attribute is <code>true</code> by
1217   * defaults.
1218   * @since DOM Level 3
1219   *
1220   * NEEDSDOC ($objectName$) @return
1221   */

1222  public boolean getStrictErrorChecking()
1223  {
1224
1225    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1226
1227    return false;
1228  }
1229
1230  /**
1231   * <p>EXPERIMENTAL! Based on the <a
1232   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1233   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1234   * <p>
1235   * An attribute specifying whether errors checking is enforced or not.
1236   * When set to <code>false</code>, the implementation is free to not
1237   * test every possible error case normally defined on DOM operations,
1238   * and not raise any <code>DOMException</code>. In case of error, the
1239   * behavior is undefined. This attribute is <code>true</code> by
1240   * defaults.
1241   * @since DOM Level 3
1242   *
1243   * NEEDSDOC @param strictErrorChecking
1244   */

1245  public void setStrictErrorChecking(boolean strictErrorChecking)
1246  {
1247    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1248  }
1249
1250  /**
1251   * <p>EXPERIMENTAL! Based on the <a
1252   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1253   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1254   * <p>
1255   * An attribute specifying, as part of the XML declaration, the version
1256   * number of this document. This is <code>null</code> when unspecified.
1257   * @since DOM Level 3
1258   *
1259   * NEEDSDOC ($objectName$) @return
1260   */

1261  public String JavaDoc getVersion()
1262  {
1263
1264    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1265
1266    return null;
1267  }
1268
1269  /**
1270   * <p>EXPERIMENTAL! Based on the <a
1271   * HREF='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010605'>Document
1272   * Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.</a>.
1273   * <p>
1274   * An attribute specifying, as part of the XML declaration, the version
1275   * number of this document. This is <code>null</code> when unspecified.
1276   * @since DOM Level 3
1277   *
1278   * NEEDSDOC @param version
1279   */

1280  public void setVersion(String JavaDoc version)
1281  {
1282    error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED);
1283  }
1284
1285
1286
1287//RAMESH : Pending proper implementation of DOM Level 3
1288

1289    public Object JavaDoc setUserData(String JavaDoc key,
1290                              Object JavaDoc data,
1291                              UserDataHandler JavaDoc handler) {
1292        return getOwnerDocument().setUserData( key, data, handler);
1293    }
1294
1295    /**
1296     * Retrieves the object associated to a key on a this node. The object
1297     * must first have been set to this node by calling
1298     * <code>setUserData</code> with the same key.
1299     * @param key The key the object is associated to.
1300     * @return Returns the <code>DOMObject</code> associated to the given key
1301     * on this node, or <code>null</code> if there was none.
1302     * @since DOM Level 3
1303     */

1304    public Object JavaDoc getUserData(String JavaDoc key) {
1305        return getOwnerDocument().getUserData( key);
1306    }
1307
1308      /**
1309     * This method returns a specialized object which implements the
1310     * specialized APIs of the specified feature and version. The
1311     * specialized object may also be obtained by using binding-specific
1312     * casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
1313     * @param feature The name of the feature requested (case-insensitive).
1314     * @param version This is the version number of the feature to test. If
1315     * the version is <code>null</code> or the empty string, supporting
1316     * any version of the feature will cause the method to return an
1317     * object that supports at least one version of the feature.
1318     * @return Returns an object which implements the specialized APIs of
1319     * the specified feature and version, if any, or <code>null</code> if
1320     * there is no object which implements interfaces associated with that
1321     * feature. If the <code>DOMObject</code> returned by this method
1322     * implements the <code>Node</code> interface, it must delegate to the
1323     * primary core <code>Node</code> and not return results inconsistent
1324     * with the primary core <code>Node</code> such as attributes,
1325     * childNodes, etc.
1326     * @since DOM Level 3
1327     */

1328    public Object JavaDoc getFeature(String JavaDoc feature, String JavaDoc version) {
1329        // we don't have any alternate node, either this node does the job
1330
// or we don't have anything that does
1331
return isSupported(feature, version) ? this : null;
1332    }
1333
1334    /**
1335     * Tests whether two nodes are equal.
1336     * <br>This method tests for equality of nodes, not sameness (i.e.,
1337     * whether the two nodes are references to the same object) which can be
1338     * tested with <code>Node.isSameNode</code>. All nodes that are the same
1339     * will also be equal, though the reverse may not be true.
1340     * <br>Two nodes are equal if and only if the following conditions are
1341     * satisfied: The two nodes are of the same type.The following string
1342     * attributes are equal: <code>nodeName</code>, <code>localName</code>,
1343     * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
1344     * , <code>baseURI</code>. This is: they are both <code>null</code>, or
1345     * they have the same length and are character for character identical.
1346     * The <code>attributes</code> <code>NamedNodeMaps</code> are equal.
1347     * This is: they are both <code>null</code>, or they have the same
1348     * length and for each node that exists in one map there is a node that
1349     * exists in the other map and is equal, although not necessarily at the
1350     * same index.The <code>childNodes</code> <code>NodeLists</code> are
1351     * equal. This is: they are both <code>null</code>, or they have the
1352     * same length and contain equal nodes at the same index. This is true
1353     * for <code>Attr</code> nodes as for any other type of node. Note that
1354     * normalization can affect equality; to avoid this, nodes should be
1355     * normalized before being compared.
1356     * <br>For two <code>DocumentType</code> nodes to be equal, the following
1357     * conditions must also be satisfied: The following string attributes
1358     * are equal: <code>publicId</code>, <code>systemId</code>,
1359     * <code>internalSubset</code>.The <code>entities</code>
1360     * <code>NamedNodeMaps</code> are equal.The <code>notations</code>
1361     * <code>NamedNodeMaps</code> are equal.
1362     * <br>On the other hand, the following do not affect equality: the
1363     * <code>ownerDocument</code> attribute, the <code>specified</code>
1364     * attribute for <code>Attr</code> nodes, the
1365     * <code>isWhitespaceInElementContent</code> attribute for
1366     * <code>Text</code> nodes, as well as any user data or event listeners
1367     * registered on the nodes.
1368     * @param arg The node to compare equality with.
1369     * @param deep If <code>true</code>, recursively compare the subtrees; if
1370     * <code>false</code>, compare only the nodes themselves (and its
1371     * attributes, if it is an <code>Element</code>).
1372     * @return If the nodes, and possibly subtrees are equal,
1373     * <code>true</code> otherwise <code>false</code>.
1374     * @since DOM Level 3
1375     */

1376    public boolean isEqualNode(Node JavaDoc arg) {
1377        if (arg == this) {
1378            return true;
1379        }
1380        if (arg.getNodeType() != getNodeType()) {
1381            return false;
1382        }
1383        // in theory nodeName can't be null but better be careful
1384
// who knows what other implementations may be doing?...
1385
if (getNodeName() == null) {
1386            if (arg.getNodeName() != null) {
1387                return false;
1388            }
1389        }
1390        else if (!getNodeName().equals(arg.getNodeName())) {
1391            return false;
1392        }
1393
1394        if (getLocalName() == null) {
1395            if (arg.getLocalName() != null) {
1396                return false;
1397            }
1398        }
1399        else if (!getLocalName().equals(arg.getLocalName())) {
1400            return false;
1401        }
1402
1403        if (getNamespaceURI() == null) {
1404            if (arg.getNamespaceURI() != null) {
1405                return false;
1406            }
1407        }
1408        else if (!getNamespaceURI().equals(arg.getNamespaceURI())) {
1409            return false;
1410        }
1411
1412        if (getPrefix() == null) {
1413            if (arg.getPrefix() != null) {
1414                return false;
1415            }
1416        }
1417        else if (!getPrefix().equals(arg.getPrefix())) {
1418            return false;
1419        }
1420
1421        if (getNodeValue() == null) {
1422            if (arg.getNodeValue() != null) {
1423                return false;
1424            }
1425        }
1426        else if (!getNodeValue().equals(arg.getNodeValue())) {
1427            return false;
1428        }
1429    /*
1430        if (getBaseURI() == null) {
1431            if (((NodeImpl) arg).getBaseURI() != null) {
1432                return false;
1433            }
1434        }
1435        else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
1436            return false;
1437        }
1438*/

1439
1440             return true;
1441    }
1442
1443      /**
1444     * DOM Level 3 - Experimental:
1445     * Look up the namespace URI associated to the given prefix, starting from this node.
1446     * Use lookupNamespaceURI(null) to lookup the default namespace
1447     *
1448     * @param namespaceURI
1449     * @return th URI for the namespace
1450     * @since DOM Level 3
1451     */

1452    public String JavaDoc lookupNamespaceURI(String JavaDoc specifiedPrefix) {
1453        short type = this.getNodeType();
1454        switch (type) {
1455        case Node.ELEMENT_NODE : {
1456
1457                String JavaDoc namespace = this.getNamespaceURI();
1458                String JavaDoc prefix = this.getPrefix();
1459                if (namespace !=null) {
1460                    // REVISIT: is it possible that prefix is empty string?
1461
if (specifiedPrefix== null && prefix==specifiedPrefix) {
1462                        // looking for default namespace
1463
return namespace;
1464                    } else if (prefix != null && prefix.equals(specifiedPrefix)) {
1465                        // non default namespace
1466
return namespace;
1467                    }
1468                }
1469                if (this.hasAttributes()) {
1470                    NamedNodeMap JavaDoc map = this.getAttributes();
1471                    int length = map.getLength();
1472                    for (int i=0;i<length;i++) {
1473                        Node JavaDoc attr = map.item(i);
1474                        String JavaDoc attrPrefix = attr.getPrefix();
1475                        String JavaDoc value = attr.getNodeValue();
1476                        namespace = attr.getNamespaceURI();
1477                        if (namespace !=null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
1478                            // at this point we are dealing with DOM Level 2 nodes only
1479
if (specifiedPrefix == null &&
1480                                attr.getNodeName().equals("xmlns")) {
1481                                // default namespace
1482
return value;
1483                            } else if (attrPrefix !=null &&
1484                                       attrPrefix.equals("xmlns") &&
1485                                       attr.getLocalName().equals(specifiedPrefix)) {
1486                 // non default namespace
1487
return value;
1488                            }
1489                        }
1490                    }
1491                }
1492        /*
1493                NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1494                if (ancestor != null) {
1495                    return ancestor.lookupNamespaceURI(specifiedPrefix);
1496                }
1497        */

1498
1499                return null;
1500
1501
1502            }
1503/*
1504        case Node.DOCUMENT_NODE : {
1505                return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
1506            }
1507*/

1508        case Node.ENTITY_NODE :
1509        case Node.NOTATION_NODE:
1510        case Node.DOCUMENT_FRAGMENT_NODE:
1511        case Node.DOCUMENT_TYPE_NODE:
1512            // type is unknown
1513
return null;
1514        case Node.ATTRIBUTE_NODE:{
1515                if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
1516                    return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
1517
1518                }
1519                return null;
1520            }
1521        default:{
1522       /*
1523                NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1524                if (ancestor != null) {
1525                    return ancestor.lookupNamespaceURI(specifiedPrefix);
1526                }
1527             */

1528                return null;
1529            }
1530
1531        }
1532    }
1533
1534    
1535    /**
1536     * DOM Level 3: Experimental
1537     * This method checks if the specified <code>namespaceURI</code> is the
1538     * default namespace or not.
1539     * @param namespaceURI The namespace URI to look for.
1540     * @return <code>true</code> if the specified <code>namespaceURI</code>
1541     * is the default namespace, <code>false</code> otherwise.
1542     * @since DOM Level 3
1543     */

1544    public boolean isDefaultNamespace(String JavaDoc namespaceURI){
1545       /*
1546        // REVISIT: remove casts when DOM L3 becomes REC.
1547        short type = this.getNodeType();
1548        switch (type) {
1549        case Node.ELEMENT_NODE: {
1550            String namespace = this.getNamespaceURI();
1551            String prefix = this.getPrefix();
1552
1553            // REVISIT: is it possible that prefix is empty string?
1554            if (prefix == null || prefix.length() == 0) {
1555                if (namespaceURI == null) {
1556                    return (namespace == namespaceURI);
1557                }
1558                return namespaceURI.equals(namespace);
1559            }
1560            if (this.hasAttributes()) {
1561                ElementImpl elem = (ElementImpl)this;
1562                NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns");
1563                if (attr != null) {
1564                    String value = attr.getNodeValue();
1565                    if (namespaceURI == null) {
1566                        return (namespace == value);
1567                    }
1568                    return namespaceURI.equals(value);
1569                }
1570            }
1571
1572            NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1573            if (ancestor != null) {
1574                return ancestor.isDefaultNamespace(namespaceURI);
1575            }
1576            return false;
1577        }
1578        case Node.DOCUMENT_NODE:{
1579                return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI);
1580            }
1581
1582        case Node.ENTITY_NODE :
1583          case Node.NOTATION_NODE:
1584        case Node.DOCUMENT_FRAGMENT_NODE:
1585        case Node.DOCUMENT_TYPE_NODE:
1586            // type is unknown
1587            return false;
1588        case Node.ATTRIBUTE_NODE:{
1589                if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
1590                    return ownerNode.isDefaultNamespace(namespaceURI);
1591
1592                }
1593                return false;
1594            }
1595        default:{
1596                NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1597                if (ancestor != null) {
1598                    return ancestor.isDefaultNamespace(namespaceURI);
1599                }
1600                return false;
1601            }
1602
1603        }
1604*/

1605        return false;
1606
1607
1608    }
1609
1610      /**
1611     *
1612     * DOM Level 3 - Experimental:
1613     * Look up the prefix associated to the given namespace URI, starting from this node.
1614     *
1615     * @param namespaceURI
1616     * @return the prefix for the namespace
1617     */

1618    public String JavaDoc lookupPrefix(String JavaDoc namespaceURI){
1619
1620        // REVISIT: When Namespaces 1.1 comes out this may not be true
1621
// Prefix can't be bound to null namespace
1622
if (namespaceURI == null) {
1623            return null;
1624        }
1625
1626        short type = this.getNodeType();
1627
1628        switch (type) {
1629/*
1630        case Node.ELEMENT_NODE: {
1631
1632                String namespace = this.getNamespaceURI(); // to flip out children
1633                return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
1634            }
1635
1636        case Node.DOCUMENT_NODE:{
1637                return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
1638            }
1639*/

1640        case Node.ENTITY_NODE :
1641        case Node.NOTATION_NODE:
1642        case Node.DOCUMENT_FRAGMENT_NODE:
1643        case Node.DOCUMENT_TYPE_NODE:
1644            // type is unknown
1645
return null;
1646        case Node.ATTRIBUTE_NODE:{
1647                if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
1648                    return getOwnerElement().lookupPrefix(namespaceURI);
1649
1650                }
1651                return null;
1652            }
1653        default:{
1654/*
1655                NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
1656                if (ancestor != null) {
1657                    return ancestor.lookupPrefix(namespaceURI);
1658                }
1659*/

1660                return null;
1661            }
1662         }
1663    }
1664
1665     /**
1666     * Returns whether this node is the same node as the given one.
1667     * <br>This method provides a way to determine whether two
1668     * <code>Node</code> references returned by the implementation reference
1669     * the same object. When two <code>Node</code> references are references
1670     * to the same object, even if through a proxy, the references may be
1671     * used completely interchangably, such that all attributes have the
1672     * same values and calling the same DOM method on either reference
1673     * always has exactly the same effect.
1674     * @param other The node to test against.
1675     * @return Returns <code>true</code> if the nodes are the same,
1676     * <code>false</code> otherwise.
1677     * @since DOM Level 3
1678     */

1679    public boolean isSameNode(Node JavaDoc other) {
1680        // we do not use any wrapper so the answer is obvious
1681
return this == other;
1682    }
1683
1684      /**
1685     * This attribute returns the text content of this node and its
1686     * descendants. When it is defined to be null, setting it has no effect.
1687     * When set, any possible children this node may have are removed and
1688     * replaced by a single <code>Text</code> node containing the string
1689     * this attribute is set to. On getting, no serialization is performed,
1690     * the returned string does not contain any markup. No whitespace
1691     * normalization is performed, the returned string does not contain the
1692     * element content whitespaces . Similarly, on setting, no parsing is
1693     * performed either, the input string is taken as pure textual content.
1694     * <br>The string returned is made of the text content of this node
1695     * depending on its type, as defined below:
1696     * <table border='1'>
1697     * <tr>
1698     * <th>Node type</th>
1699     * <th>Content</th>
1700     * </tr>
1701     * <tr>
1702     * <td valign='top' rowspan='1' colspan='1'>
1703     * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
1704     * DOCUMENT_FRAGMENT_NODE</td>
1705     * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
1706     * attribute value of every child node, excluding COMMENT_NODE and
1707     * PROCESSING_INSTRUCTION_NODE nodes</td>
1708     * </tr>
1709     * <tr>
1710     * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
1711     * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
1712     * <td valign='top' rowspan='1' colspan='1'>
1713     * <code>nodeValue</code></td>
1714     * </tr>
1715     * <tr>
1716     * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
1717     * <td valign='top' rowspan='1' colspan='1'>
1718     * null</td>
1719     * </tr>
1720     * </table>
1721     * @exception DOMException
1722     * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
1723     * @exception DOMException
1724     * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
1725     * fit in a <code>DOMString</code> variable on the implementation
1726     * platform.
1727       * @since DOM Level 3
1728     */

1729    public void setTextContent(String JavaDoc textContent)
1730        throws DOMException JavaDoc {
1731        setNodeValue(textContent);
1732    }
1733    /**
1734     * This attribute returns the text content of this node and its
1735     * descendants. When it is defined to be null, setting it has no effect.
1736     * When set, any possible children this node may have are removed and
1737     * replaced by a single <code>Text</code> node containing the string
1738     * this attribute is set to. On getting, no serialization is performed,
1739     * the returned string does not contain any markup. No whitespace
1740     * normalization is performed, the returned string does not contain the
1741     * element content whitespaces . Similarly, on setting, no parsing is
1742     * performed either, the input string is taken as pure textual content.
1743     * <br>The string returned is made of the text content of this node
1744     * depending on its type, as defined below:
1745     * <table border='1'>
1746     * <tr>
1747     * <th>Node type</th>
1748     * <th>Content</th>
1749     * </tr>
1750     * <tr>
1751     * <td valign='top' rowspan='1' colspan='1'>
1752     * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
1753     * DOCUMENT_FRAGMENT_NODE</td>
1754     * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
1755     * attribute value of every child node, excluding COMMENT_NODE and
1756     * PROCESSING_INSTRUCTION_NODE nodes</td>
1757     * </tr>
1758     * <tr>
1759     * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
1760     * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
1761     * <td valign='top' rowspan='1' colspan='1'>
1762     * <code>nodeValue</code></td>
1763     * </tr>
1764     * <tr>
1765     * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
1766     * <td valign='top' rowspan='1' colspan='1'>
1767     * null</td>
1768     * </tr>
1769     * </table>
1770     * @exception DOMException
1771     * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
1772     * @exception DOMException
1773     * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
1774     * fit in a <code>DOMString</code> variable on the implementation
1775     * platform.
1776     * @since DOM Level 3
1777     */

1778    public String JavaDoc getTextContent() throws DOMException JavaDoc {
1779        return getNodeValue(); // overriden in some subclasses
1780
}
1781
1782     /**
1783     * Compares a node with this node with regard to their position in the
1784     * document.
1785     * @param other The node to compare against this node.
1786     * @return Returns how the given node is positioned relatively to this
1787     * node.
1788     * @since DOM Level 3
1789     */

1790    public short compareDocumentPosition(Node JavaDoc other) throws DOMException JavaDoc {
1791        return 0;
1792    }
1793
1794     /**
1795     * The absolute base URI of this node or <code>null</code> if undefined.
1796     * This value is computed according to . However, when the
1797     * <code>Document</code> supports the feature "HTML" , the base URI is
1798     * computed using first the value of the href attribute of the HTML BASE
1799     * element if any, and the value of the <code>documentURI</code>
1800     * attribute from the <code>Document</code> interface otherwise.
1801     * <br> When the node is an <code>Element</code>, a <code>Document</code>
1802     * or a a <code>ProcessingInstruction</code>, this attribute represents
1803     * the properties [base URI] defined in . When the node is a
1804     * <code>Notation</code>, an <code>Entity</code>, or an
1805     * <code>EntityReference</code>, this attribute represents the
1806     * properties [declaration base URI] in the . How will this be affected
1807     * by resolution of relative namespace URIs issue?It's not.Should this
1808     * only be on Document, Element, ProcessingInstruction, Entity, and
1809     * Notation nodes, according to the infoset? If not, what is it equal to
1810     * on other nodes? Null? An empty string? I think it should be the
1811     * parent's.No.Should this be read-only and computed or and actual
1812     * read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
1813     * teleconference 30 May 2001).If the base HTML element is not yet
1814     * attached to a document, does the insert change the Document.baseURI?
1815     * Yes. (F2F 26 Sep 2001)
1816     * @since DOM Level 3
1817     */

1818    public String JavaDoc getBaseURI() {
1819        return null;
1820    }
1821
1822        /**
1823     * DOM Level 3 WD - Experimental.
1824     * Renaming node
1825     */

1826    public Node JavaDoc renameNode(Node JavaDoc n,
1827                           String JavaDoc namespaceURI,
1828                           String JavaDoc name)
1829                           throws DOMException JavaDoc{
1830        return n;
1831    }
1832
1833    
1834    /**
1835     * DOM Level 3 WD - Experimental
1836     * Normalize document.
1837     */

1838    public void normalizeDocument(){
1839
1840    }
1841    /**
1842     * The configuration used when <code>Document.normalizeDocument</code> is
1843     * invoked.
1844     * @since DOM Level 3
1845     */

1846    public DOMConfiguration JavaDoc getDomConfig(){
1847       return null;
1848    }
1849
1850    
1851    /**Experimental DOM Level 3 feature: documentURI */
1852    protected String JavaDoc fDocumentURI;
1853
1854    /**
1855     * DOM Level 3 WD - Experimental.
1856     */

1857    public void setDocumentURI(String JavaDoc documentURI){
1858        
1859        fDocumentURI= documentURI;
1860    }
1861
1862        /**
1863     * DOM Level 3 WD - Experimental.
1864     * The location of the document or <code>null</code> if undefined.
1865     * <br>Beware that when the <code>Document</code> supports the feature
1866     * "HTML" , the href attribute of the HTML BASE element takes precedence
1867     * over this attribute.
1868     * @since DOM Level 3
1869     */

1870    public String JavaDoc getDocumentURI(){
1871        return fDocumentURI;
1872    }
1873
1874        /**Experimental DOM Level 3 feature: Document actualEncoding */
1875    protected String JavaDoc actualEncoding;
1876
1877     /**
1878     * DOM Level 3 WD - Experimental.
1879     * An attribute specifying the actual encoding of this document. This is
1880     * <code>null</code> otherwise.
1881     * <br> This attribute represents the property [character encoding scheme]
1882     * defined in .
1883     * @since DOM Level 3
1884     */

1885    public String JavaDoc getActualEncoding() {
1886        return actualEncoding;
1887    }
1888
1889    /**
1890     * DOM Level 3 WD - Experimental.
1891     * An attribute specifying the actual encoding of this document. This is
1892     * <code>null</code> otherwise.
1893     * <br> This attribute represents the property [character encoding scheme]
1894     * defined in .
1895     * @since DOM Level 3
1896     */

1897    public void setActualEncoding(String JavaDoc value) {
1898        actualEncoding = value;
1899    }
1900
1901     /**
1902    * DOM Level 3 WD - Experimental.
1903    */

1904    public Text JavaDoc replaceWholeText(String JavaDoc content)
1905                                 throws DOMException JavaDoc{
1906/*
1907
1908        if (needsSyncData()) {
1909            synchronizeData();
1910        }
1911
1912        // make sure we can make the replacement
1913        if (!canModify(nextSibling)) {
1914            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
1915                DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null));
1916        }
1917
1918        Node parent = this.getParentNode();
1919        if (content == null || content.length() == 0) {
1920            // remove current node
1921            if (parent !=null) { // check if node in the tree
1922                parent.removeChild(this);
1923                return null;
1924            }
1925        }
1926        Text currentNode = null;
1927        if (isReadOnly()){
1928            Text newNode = this.ownerDocument().createTextNode(content);
1929            if (parent !=null) { // check if node in the tree
1930                parent.insertBefore(newNode, this);
1931                parent.removeChild(this);
1932                currentNode = newNode;
1933            } else {
1934                return newNode;
1935            }
1936        } else {
1937            this.setData(content);
1938            currentNode = this;
1939        }
1940        Node sibling = currentNode.getNextSibling();
1941        while ( sibling !=null) {
1942            parent.removeChild(sibling);
1943            sibling = currentNode.getNextSibling();
1944        }
1945
1946        return currentNode;
1947*/

1948        return null; //Pending
1949
}
1950
1951     /**
1952     * DOM Level 3 WD - Experimental.
1953     * Returns all text of <code>Text</code> nodes logically-adjacent text
1954     * nodes to this node, concatenated in document order.
1955     * @since DOM Level 3
1956     */

1957    public String JavaDoc getWholeText(){
1958
1959/*
1960        if (needsSyncData()) {
1961            synchronizeData();
1962        }
1963        if (nextSibling == null) {
1964            return data;
1965        }
1966        StringBuffer buffer = new StringBuffer();
1967        if (data != null && data.length() != 0) {
1968            buffer.append(data);
1969        }
1970        getWholeText(nextSibling, buffer);
1971        return buffer.toString();
1972*/

1973        return null; // PENDING
1974

1975    }
1976
1977      /**
1978    * DOM Level 3 WD - Experimental.
1979     * Returns whether this text node contains whitespace in element content,
1980     * often abusively called "ignorable whitespace".
1981     */

1982    public boolean isWhitespaceInElementContent(){
1983        return false;
1984    }
1985
1986
1987
1988
1989     /**
1990     * NON-DOM: set the type of this attribute to be ID type.
1991     *
1992     * @param id
1993     */

1994    public void setIdAttribute(boolean id){
1995        //PENDING
1996
}
1997
1998     /**
1999     * DOM Level 3: register the given attribute node as an ID attribute
2000     */

2001    public void setIdAttribute(String JavaDoc name, boolean makeId) {
2002        //PENDING
2003
}
2004
2005       
2006    /**
2007     * DOM Level 3: register the given attribute node as an ID attribute
2008     */

2009    public void setIdAttributeNode(Attr JavaDoc at, boolean makeId) {
2010        //PENDING
2011
}
2012
2013    /**
2014     * DOM Level 3: register the given attribute node as an ID attribute
2015     */

2016    public void setIdAttributeNS(String JavaDoc namespaceURI, String JavaDoc localName,
2017                                    boolean makeId) {
2018        //PENDING
2019
}
2020         /**
2021         * Method getSchemaTypeInfo.
2022         * @return TypeInfo
2023         */

2024    public TypeInfo JavaDoc getSchemaTypeInfo(){
2025      return null; //PENDING
2026
}
2027
2028    public boolean isId() {
2029        return false; //PENDING
2030
}
2031  
2032    private String JavaDoc xmlEncoding;
2033    public String JavaDoc getXmlEncoding ( ) {
2034        return xmlEncoding;
2035    }
2036    public void setXmlEncoding ( String JavaDoc xmlEncoding ) {
2037        this.xmlEncoding = xmlEncoding;
2038    }
2039  
2040    private boolean xmlStandalone;
2041    public boolean getXmlStandalone() {
2042        return xmlStandalone;
2043    }
2044
2045    public void setXmlStandalone(boolean xmlStandalone) throws DOMException JavaDoc {
2046        this.xmlStandalone = xmlStandalone;
2047    }
2048
2049    private String JavaDoc xmlVersion;
2050    public String JavaDoc getXmlVersion() {
2051        return xmlVersion;
2052    }
2053
2054    public void setXmlVersion(String JavaDoc xmlVersion) throws DOMException JavaDoc {
2055        this.xmlVersion = xmlVersion;
2056    }
2057
2058
2059}
2060
Popular Tags