KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xmlc > XMLObjectImpl


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: XMLObjectImpl.java,v 1.5 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.xmlc;
25
26 import org.enhydra.xml.dom.DOMOps;
27 import org.enhydra.xml.io.DOMFormatter;
28 import org.enhydra.xml.io.DocumentInfo;
29 import org.enhydra.xml.xmlc.dom.XMLCDomFactory;
30 import org.w3c.dom.Attr JavaDoc;
31 import org.w3c.dom.CDATASection JavaDoc;
32 import org.w3c.dom.Comment JavaDoc;
33 import org.w3c.dom.DOMConfiguration JavaDoc;
34 import org.w3c.dom.DOMException JavaDoc;
35 import org.w3c.dom.DOMImplementation JavaDoc;
36 import org.w3c.dom.Document JavaDoc;
37 import org.w3c.dom.DocumentFragment JavaDoc;
38 import org.w3c.dom.DocumentType JavaDoc;
39 import org.w3c.dom.Element JavaDoc;
40 import org.w3c.dom.EntityReference JavaDoc;
41 import org.w3c.dom.NamedNodeMap JavaDoc;
42 import org.w3c.dom.Node JavaDoc;
43 import org.w3c.dom.NodeList JavaDoc;
44 import org.w3c.dom.ProcessingInstruction JavaDoc;
45 import org.w3c.dom.Text JavaDoc;
46 import org.w3c.dom.UserDataHandler JavaDoc;
47
48 //FIXME: Should getDomFactory be in interface?
49
//FIXME: Should domFactory be be pasted.
50

51 /**
52  * Base class for all compiled XML objects.
53  * @see XMLObject
54  */

55 public abstract class XMLObjectImpl implements XMLObject, Document JavaDoc, DocumentInfo {
56     /**
57      * Default XML formatting object for use by toDocument(). Initialized
58      * on first use and shared
59      */

60     private static DOMFormatter fFormatter = null;
61
62     /**
63      * The document the object is associated with.
64      */

65     private Document JavaDoc fDocument;
66
67     /**
68      * The MIME type associated with the document.
69      */

70     private String JavaDoc fMIMEType;
71
72     /**
73      * The delegate object.
74      */

75     private XMLObject fDelegate;
76
77     /**
78      * Constructor. The setDocument() method must be called to
79      * associate a document with this object.
80      */

81     protected XMLObjectImpl() {
82     }
83
84     /**
85      * Set the DOM document associated with this object and optional encoding.
86      * This is used by buildDocument() to set the new document. It is done
87      * separately from the constructor to allow buildDocument() to not be
88      * called immediatly.
89      */

90     protected void setDocument(Document JavaDoc document,
91                                String JavaDoc mimeType,
92                                String JavaDoc encoding) {
93         fDocument = document;
94         fMIMEType = mimeType;
95         setEncoding(encoding);
96
97         // Link Document back to this object if it supports XMLObjectLink
98
if (document instanceof XMLObjectLink) {
99             ((XMLObjectLink)document).setXMLObject(this);
100         }
101     }
102
103     /**
104      * Get the XMLC DOM Factory associated with this document type and DOM
105      * implementation.
106      */

107     protected abstract XMLCDomFactory getDomFactory();
108
109     /**
110      * @see XMLObject#getDocument
111      */

112     public Document JavaDoc getDocument() {
113         if (fDelegate != null) {
114             return fDelegate.getDocument();
115         } else {
116             return fDocument;
117         }
118     }
119
120     /**
121      * @see XMLObject#getMIMEType
122      */

123     public String JavaDoc getMIMEType() {
124         if (fDelegate != null) {
125             return fDelegate.getMIMEType();
126         } else {
127             return fMIMEType;
128         }
129     }
130
131     /**
132      * @see XMLObject#setDelegate
133      */

134     public void setDelegate(XMLObject delegate) {
135         fDelegate = delegate;
136     }
137
138     /**
139      * @see XMLObject#getDelegate
140      */

141     public XMLObject getDelegate() {
142         return fDelegate;
143     }
144
145     /**
146      * Check that cloneNode on an entire document is done with the
147      * deep option.
148      */

149     protected void cloneDeepCheck(boolean deep) {
150         if (!deep) {
151             throw new XMLCError("Must use deep clone when cloning entire document");
152         }
153     }
154
155     /**
156      * Clone the entire document. Derived objects should override this
157      * to get the correct derived type. Cloning with deep being false
158      * is not allowed.
159      *
160      * @see org.w3c.dom.Node#cloneNode
161      */

162     abstract public Node JavaDoc cloneNode(boolean deep);
163
164     /**
165      * @see org.w3c.dom.Document#getDoctype
166      */

167     public DocumentType JavaDoc getDoctype() {
168         if (fDelegate != null) {
169             return fDelegate.getDoctype();
170         } else {
171             return fDocument.getDoctype();
172         }
173     }
174
175     /**
176      * @see org.w3c.dom.Document#getImplementation
177      */

178     public DOMImplementation JavaDoc getImplementation() {
179         if (fDelegate != null) {
180             return fDelegate.getImplementation();
181         } else {
182             return fDocument.getImplementation();
183         }
184     }
185
186     /**
187      * @see org.w3c.dom.Document#getDocumentElement
188      */

189     public Element JavaDoc getDocumentElement() {
190         if (fDelegate != null) {
191             return fDelegate.getDocumentElement();
192         } else {
193             return fDocument.getDocumentElement();
194         }
195     }
196
197     /**
198      * @see org.w3c.dom.Document#importNode
199      */

200     public Node JavaDoc importNode(Node JavaDoc importedNode,
201                            boolean deep)
202         throws DOMException JavaDoc {
203         if (fDelegate != null) {
204             return fDelegate.importNode(importedNode, deep);
205         } else {
206             return fDocument.importNode(importedNode, deep);
207         }
208     }
209
210     /**
211      * @see org.w3c.dom.Document#createElement
212      */

213     public Element JavaDoc createElement(String JavaDoc tagName)
214         throws DOMException JavaDoc {
215         if (fDelegate != null) {
216             return fDelegate.createElement(tagName);
217         } else {
218             return fDocument.createElement(tagName);
219         }
220     }
221
222     /**
223      * @see org.w3c.dom.Document#createElementNS
224      */

225     public Element JavaDoc createElementNS(String JavaDoc namespaceURI,
226                                    String JavaDoc qualifiedName)
227         throws DOMException JavaDoc {
228         if (fDelegate != null) {
229             return fDelegate.createElementNS(namespaceURI, qualifiedName);
230         } else {
231             return fDocument.createElementNS(namespaceURI, qualifiedName);
232         }
233     }
234
235     /**
236      * @see org.w3c.dom.Document#createDocumentFragment
237      */

238     public DocumentFragment JavaDoc createDocumentFragment() {
239         if (fDelegate != null) {
240             return fDelegate.createDocumentFragment();
241         } else {
242             return fDocument.createDocumentFragment();
243         }
244     }
245
246     /**
247      * @see org.w3c.dom.Document#createTextNode
248      */

249     public Text JavaDoc createTextNode(String JavaDoc data) {
250         if (fDelegate != null) {
251             return fDelegate.createTextNode(data);
252         } else {
253             return fDocument.createTextNode(data);
254         }
255     }
256
257     /**
258      * @see org.w3c.dom.Document#createComment
259      */

260     public Comment JavaDoc createComment(String JavaDoc data) {
261         if (fDelegate != null) {
262             return fDelegate.createComment(data);
263         } else {
264             return fDocument.createComment(data);
265         }
266     }
267
268     /**
269      * @see org.w3c.dom.Document#createCDATASection
270      */

271     public CDATASection JavaDoc createCDATASection(String JavaDoc data)
272         throws DOMException JavaDoc {
273         if (fDelegate != null) {
274             return fDelegate.createCDATASection(data);
275         } else {
276             return fDocument.createCDATASection(data);
277         }
278     }
279
280     /**
281      * @see org.w3c.dom.Document#createProcessingInstruction
282      */

283     public ProcessingInstruction JavaDoc createProcessingInstruction(String JavaDoc target,
284                                                              String JavaDoc data)
285         throws DOMException JavaDoc {
286         if (fDelegate != null) {
287             return fDelegate.createProcessingInstruction(target, data);
288         } else {
289             return fDocument.createProcessingInstruction(target, data);
290         }
291     }
292
293     /**
294      * @see org.w3c.dom.Document#createAttribute
295      */

296     public Attr JavaDoc createAttribute(String JavaDoc qualifiedName)
297         throws DOMException JavaDoc {
298         if (fDelegate != null) {
299             return fDelegate.createAttribute(qualifiedName);
300         } else {
301             return fDocument.createAttribute(qualifiedName);
302         }
303     }
304
305     /**
306      * @see org.w3c.dom.Document#createAttributeNS
307      */

308     public Attr JavaDoc createAttributeNS(String JavaDoc namespaceURI,
309                                   String JavaDoc qualifiedName)
310         throws DOMException JavaDoc {
311         if (fDelegate != null) {
312             return fDelegate.createAttributeNS(namespaceURI, qualifiedName);
313         } else {
314             return fDocument.createAttributeNS(namespaceURI, qualifiedName);
315         }
316     }
317
318     /**
319      * @see org.w3c.dom.Document#createEntityReference
320      */

321     public EntityReference JavaDoc createEntityReference(String JavaDoc name)
322         throws DOMException JavaDoc {
323         if (fDelegate != null) {
324             return fDelegate.createEntityReference(name);
325         } else {
326             return fDocument.createEntityReference(name);
327         }
328     }
329
330     /**
331      * @see org.w3c.dom.Document#getElementsByTagName
332      */

333     public NodeList JavaDoc getElementsByTagName(String JavaDoc tagname) {
334         if (fDelegate != null) {
335             return fDelegate.getElementsByTagName(tagname);
336         } else {
337             return fDocument.getElementsByTagName(tagname);
338         }
339     }
340
341     /**
342      * @see org.w3c.dom.Document#getElementsByTagNameNS
343      */

344     public NodeList JavaDoc getElementsByTagNameNS(String JavaDoc namespaceURI,
345                                            String JavaDoc localName) {
346         if (fDelegate != null) {
347             return fDelegate.getElementsByTagNameNS(namespaceURI, localName);
348         } else {
349             return fDocument.getElementsByTagNameNS(namespaceURI, localName);
350         }
351     }
352
353     /**
354      * @see org.w3c.dom.Document#getElementById
355      */

356     public Element JavaDoc getElementById(String JavaDoc elementId) {
357         if (fDelegate != null) {
358             return fDelegate.getElementById(elementId);
359         } else {
360             return fDocument.getElementById(elementId);
361         }
362     }
363
364     /**
365      * See org.w3c.dom.Document#getEncoding
366      */

367     public String JavaDoc getEncoding() {
368         if (fDelegate != null) {
369             return fDelegate.getEncoding();
370         } else {
371             return DOMOps.getEncoding(fDocument);
372         }
373     }
374
375     /**
376      * See org.w3c.dom.Document#setEncoding
377      */

378     public void setEncoding(String JavaDoc encoding) {
379         if (fDelegate != null) {
380             fDelegate.setEncoding(encoding);
381         } else {
382             DOMOps.setEncoding(fDocument, encoding);
383         }
384     }
385
386     /**
387      * See org.w3c.dom.Document#getStandalone
388      */

389     public boolean getStandalone() {
390         if (fDelegate != null) {
391             return fDelegate.getStandalone();
392         } else {
393             return DOMOps.getStandalone(fDocument);
394         }
395     }
396
397     /**
398      * See org.w3c.dom.Document#setStandalone
399      */

400     public void setStandalone(boolean standalone) {
401         if (fDelegate != null) {
402             fDelegate.setStandalone(standalone);
403         } else {
404             DOMOps.setStandalone(fDocument, standalone);
405         }
406     }
407
408     /**
409      * See org.w3c.dom.Document#getStrictErrorChecking
410      */

411     public boolean getStrictErrorChecking() {
412         if (fDelegate != null) {
413             return fDelegate.getStrictErrorChecking();
414         } else {
415             return DOMOps.getStrictErrorChecking(fDocument);
416         }
417     }
418
419     /**
420      * See org.w3c.dom.Document#setStrictErrorChecking
421      */

422     public void setStrictErrorChecking(boolean strictErrorChecking) {
423         if (fDelegate != null) {
424             fDelegate.setStrictErrorChecking(strictErrorChecking);
425         } else {
426             DOMOps.setStrictErrorChecking(fDocument, strictErrorChecking);
427         }
428     }
429
430     /**
431      * See org.w3c.dom.Document#getVersion()
432      */

433     public String JavaDoc getVersion() {
434         if (fDelegate != null) {
435             return fDelegate.getVersion();
436         } else {
437             return DOMOps.getVersion(fDocument);
438         }
439     }
440
441     /**
442      * See org.w3c.dom.Document#setVersion
443      */

444     public void setVersion(String JavaDoc version) {
445         if (fDelegate != null) {
446             fDelegate.setVersion(version);
447         } else {
448             DOMOps.setVersion(fDocument, version);
449         }
450     }
451
452     /**
453      * See org.w3c.dom.Document#adoptNode
454      */

455     public Node JavaDoc adoptNode(Node JavaDoc source) throws DOMException JavaDoc {
456         if (fDelegate != null) {
457             return fDelegate.adoptNode(source);
458         } else {
459             return DOMOps.adoptNode(fDocument, source);
460         }
461     }
462
463     /**
464      * @see org.w3c.dom.Node#getNodeName()
465      */

466     public String JavaDoc getNodeName() {
467         if (fDelegate != null) {
468             return fDelegate.getNodeName();
469         } else {
470             return fDocument.getNodeName();
471         }
472     }
473
474     /**
475      * @see org.w3c.dom.Node#getNodeValue()
476      */

477     public String JavaDoc getNodeValue()
478         throws DOMException JavaDoc {
479         if (fDelegate != null) {
480             return fDelegate.getNodeValue();
481         } else {
482             return fDocument.getNodeValue();
483         }
484     }
485
486     /**
487      * @see org.w3c.dom.Node#setNodeValue
488      */

489     public void setNodeValue(String JavaDoc nodeValue)
490         throws DOMException JavaDoc {
491         if (fDelegate != null) {
492             fDelegate.setNodeValue(nodeValue);
493         } else {
494             fDocument.setNodeValue(nodeValue);
495         }
496     }
497
498     /**
499      * @see org.w3c.dom.Node#getNodeType
500      */

501     public short getNodeType() {
502         if (fDelegate != null) {
503             return fDelegate.getNodeType();
504         } else {
505             return fDocument.getNodeType();
506         }
507     }
508
509     /**
510      * @see org.w3c.dom.Node#getParentNode
511      */

512     public Node JavaDoc getParentNode() {
513         if (fDelegate != null) {
514             return fDelegate.getParentNode();
515         } else {
516             return fDocument.getParentNode();
517         }
518     }
519
520     /**
521      * @see org.w3c.dom.Node#getChildNodes
522      */

523     public NodeList JavaDoc getChildNodes() {
524         if (fDelegate != null) {
525             return fDelegate.getChildNodes();
526         } else {
527             return fDocument.getChildNodes();
528         }
529     }
530
531     /**
532      * @see org.w3c.dom.Node#getFirstChild
533      */

534     public Node JavaDoc getFirstChild() {
535         if (fDelegate != null) {
536             return fDelegate.getFirstChild();
537         } else {
538             return fDocument.getFirstChild();
539         }
540     }
541
542     /**
543      * @see org.w3c.dom.Node#getLastChild
544      */

545     public Node JavaDoc getLastChild() {
546         if (fDelegate != null) {
547             return fDelegate.getLastChild();
548         } else {
549             return fDocument.getLastChild();
550         }
551     }
552
553     /**
554      * @see org.w3c.dom.Node#getPreviousSibling
555      */

556     public Node JavaDoc getPreviousSibling() {
557         if (fDelegate != null) {
558             return fDelegate.getPreviousSibling();
559         } else {
560             return fDocument.getPreviousSibling();
561         }
562     }
563
564     /**
565      * @see org.w3c.dom.Node#getNextSibling
566      */

567     public Node JavaDoc getNextSibling() {
568         if (fDelegate != null) {
569             return fDelegate.getNextSibling();
570         } else {
571             return fDocument.getNextSibling();
572         }
573     }
574
575     /**
576      * @see org.w3c.dom.Node#getAttributes
577      */

578     public NamedNodeMap JavaDoc getAttributes() {
579         if (fDelegate != null) {
580             return fDelegate.getAttributes();
581         } else {
582             return fDocument.getAttributes();
583         }
584     }
585
586     /**
587      * @see org.w3c.dom.Node#getOwnerDocument
588      */

589     public Document JavaDoc getOwnerDocument() {
590         if (fDelegate != null) {
591             return fDelegate.getOwnerDocument();
592         } else {
593             return fDocument.getOwnerDocument();
594         }
595     }
596
597     /**
598      * @see org.w3c.dom.Node#insertBefore
599      */

600     public Node JavaDoc insertBefore(Node JavaDoc newChild,
601                              Node JavaDoc refChild)
602         throws DOMException JavaDoc {
603         if (fDelegate != null) {
604             return fDelegate.insertBefore(newChild, refChild);
605         } else {
606             return fDocument.insertBefore(newChild, refChild);
607         }
608     }
609
610     /**
611      * @see org.w3c.dom.Node#replaceChild
612      */

613     public Node JavaDoc replaceChild(Node JavaDoc newChild,
614                              Node JavaDoc oldChild)
615         throws DOMException JavaDoc {
616         if (fDelegate != null) {
617             return fDelegate.replaceChild(newChild, oldChild);
618         } else {
619             return fDocument.replaceChild(newChild, oldChild);
620         }
621     }
622
623     /**
624      * @see org.w3c.dom.Node#removeChild
625      */

626     public Node JavaDoc removeChild(Node JavaDoc oldChild)
627         throws DOMException JavaDoc {
628         if (fDelegate != null) {
629             return fDelegate.removeChild(oldChild);
630         } else {
631             return fDocument.removeChild(oldChild);
632         }
633     }
634
635     /**
636      * @see org.w3c.dom.Node#appendChild
637      */

638     public Node JavaDoc appendChild(Node JavaDoc newChild)
639         throws DOMException JavaDoc {
640         if (fDelegate != null) {
641             return fDelegate.appendChild(newChild);
642         } else {
643             return fDocument.appendChild(newChild);
644         }
645     }
646
647     /**
648      * @see org.w3c.dom.Node#normalize
649      */

650     public void normalize() {
651         if (fDelegate != null) {
652             fDelegate.normalize();
653         } else {
654             fDocument.normalize();
655         }
656     }
657
658     /**
659      * @see org.w3c.dom.Node#isSupported(String, String)
660      */

661     public boolean isSupported(String JavaDoc feature,
662                             String JavaDoc version) {
663         if (fDelegate != null) {
664             return fDelegate.isSupported(feature, version);
665         } else {
666             return fDocument.isSupported(feature, version);
667         }
668     }
669
670     /**
671      * @see org.w3c.dom.Node#getNamespaceURI
672      */

673     public String JavaDoc getNamespaceURI() {
674         if (fDelegate != null) {
675             return fDelegate.getNamespaceURI();
676         } else {
677             return fDocument.getNamespaceURI();
678         }
679     }
680
681     /**
682      * @see org.w3c.dom.Node#getPrefix
683      */

684     public String JavaDoc getPrefix() {
685         if (fDelegate != null) {
686             return fDelegate.getPrefix();
687         } else {
688             return fDocument.getPrefix();
689         }
690     }
691
692     /**
693      * @see org.w3c.dom.Node#setPrefix
694      */

695     public void setPrefix(String JavaDoc prefix) {
696         if (fDelegate != null) {
697             fDelegate.setPrefix(prefix);
698         } else {
699             fDocument.setPrefix(prefix);
700         }
701     }
702
703     /**
704      * @see org.w3c.dom.Node#getLocalName
705      */

706     public String JavaDoc getLocalName() {
707         if (fDelegate != null) {
708             return fDelegate.getLocalName();
709         } else {
710             return fDocument.getLocalName();
711         }
712     }
713
714     /**
715      * @see org.w3c.dom.Node#hasChildNodes
716      */

717     public boolean hasChildNodes() {
718         if (fDelegate != null) {
719             return fDelegate.hasChildNodes();
720         } else {
721             return fDocument.hasChildNodes();
722         }
723     }
724
725     /**
726      * @see org.w3c.dom.Node#hasAttributes
727      */

728     public boolean hasAttributes() {
729         if (fDelegate != null) {
730             return fDelegate.hasAttributes();
731         } else {
732             return fDocument.hasAttributes();
733         }
734     }
735
736     /**
737      * @see XMLObject#toDocument
738      */

739     public String JavaDoc toDocument() {
740         // Create formatter if needed (no synchronization necessary)
741
if (fFormatter == null) {
742             fFormatter = new DOMFormatter(DOMFormatter.getDefaultOutputOptions(getDocument()));
743         }
744
745         if (fDelegate != null) {
746             return fFormatter.toString(fDelegate);
747         } else {
748             return fFormatter.toString(this);
749         }
750     }
751
752     /**
753      * Generated function to synchronize the fields used by the access methods.
754      * This syncronizes just the node and is not recursive.
755      */

756     abstract protected void syncWithDocument(Node JavaDoc node);
757
758     /**
759      * Recursively synchronize access methods.
760      */

761     private void syncAccessMethods(Node JavaDoc node) {
762         syncWithDocument(node);
763         for (Node JavaDoc child = node.getFirstChild(); child != null;
764              child = child.getNextSibling()) {
765             syncAccessMethods(child);
766         }
767     }
768
769     /**
770      * @see XMLObject#syncAccessMethods
771      */

772     public void syncAccessMethods() {
773         if (fDelegate != null) {
774             fDelegate.syncAccessMethods();
775         } else {
776             syncAccessMethods(fDocument);
777         }
778     }
779
780     /**
781      * Old method to initialize the fields used by the generated access
782      * methods from the current state of the document. This method was
783      * poorly named and is deprecated.
784      *
785      * @deprecated Use <CODE>syncAccessMethods()</CODE> instead.
786      * @see #syncAccessMethods
787      */

788     public void initFields() {
789         syncAccessMethods();
790     }
791
792     /**
793      * @see DocumentInfo#isURLAttribute
794      */

795     public boolean isURLAttribute(Element JavaDoc element,
796                                   String JavaDoc attrName) {
797         return getDomFactory().isURLAttribute(element, attrName);
798     }
799
800     /**
801      * Used internally to implement a setTextXXX() method. Adds check for
802      * for null value and helps to minimizes the amount of generated code.
803      */

804     protected final void doSetText(Element JavaDoc element,
805                                    String JavaDoc text) {
806         if (text == null) {
807             throw new IllegalArgumentException JavaDoc("attempt to set a DOM text node value to null");
808         }
809         //jrk_20040703 - org.enhydra.xml.xmlc.compiler.ElementInfo now generates
810
// setText*() methods for ID's without child nodes. This means
811
// one can create <span id="foo"></span> and expect the setTextFoo(String)
812
// to be generated. As such, we need to create the text node if it doesn't
813
// exist before setting data on it.
814
//XMLCUtil.getFirstText(element).setData(text);
815
Text JavaDoc textNode = XMLCUtil.findFirstText(element);
816         if (textNode == null) {
817             if (fDelegate != null) {
818                 textNode = fDelegate.createTextNode("");
819             } else {
820                 textNode = fDocument.createTextNode("");
821             }
822             element.appendChild(textNode);
823         }
824         textNode.setData(text);
825     }
826
827
828 //DOM3 methods. These are not implemented by Xerces1 which ships with XMLC as of 20050123. Make a note here when they are...
829

830     /* (non-Javadoc)
831      * @see org.w3c.dom.Document#getDocumentURI()
832      */

833     public String JavaDoc getDocumentURI() {
834         if (fDelegate != null) {
835             return fDelegate.getDocumentURI();
836         } else {
837             return fDocument.getDocumentURI();
838         }
839     }
840     /* (non-Javadoc)
841      * @see org.w3c.dom.Document#getDomConfig()
842      */

843     public DOMConfiguration JavaDoc getDomConfig() {
844         if (fDelegate != null) {
845             return fDelegate.getDomConfig();
846         } else {
847             return fDocument.getDomConfig();
848         }
849     }
850     /* (non-Javadoc)
851      * @see org.w3c.dom.Document#getInputEncoding()
852      */

853     public String JavaDoc getInputEncoding() {
854         if (fDelegate != null) {
855             return fDelegate.getInputEncoding();
856         } else {
857             return fDocument.getInputEncoding();
858         }
859     }
860     /* (non-Javadoc)
861      * @see org.w3c.dom.Document#getXmlEncoding()
862      */

863     public String JavaDoc getXmlEncoding() {
864         if (fDelegate != null) {
865             return fDelegate.getXmlEncoding();
866         } else {
867             return fDocument.getXmlEncoding();
868         }
869     }
870     /* (non-Javadoc)
871      * @see org.w3c.dom.Document#getXmlStandalone()
872      */

873     public boolean getXmlStandalone() {
874         if (fDelegate != null) {
875             return fDelegate.getXmlStandalone();
876         } else {
877             return fDocument.getXmlStandalone();
878         }
879     }
880     /* (non-Javadoc)
881      * @see org.w3c.dom.Document#getXmlVersion()
882      */

883     public String JavaDoc getXmlVersion() {
884         if (fDelegate != null) {
885             return fDelegate.getXmlVersion();
886         } else {
887             return fDocument.getXmlVersion();
888         }
889     }
890     /* (non-Javadoc)
891      * @see org.w3c.dom.Document#normalizeDocument()
892      */

893     public void normalizeDocument() {
894         if (fDelegate != null) {
895             fDelegate.normalizeDocument();
896         } else {
897             fDocument.normalizeDocument();
898         }
899     }
900     /* (non-Javadoc)
901      * @see org.w3c.dom.Document#renameNode(org.w3c.dom.Node, java.lang.String, java.lang.String)
902      */

903     public Node JavaDoc renameNode(Node JavaDoc arg0, String JavaDoc arg1, String JavaDoc arg2)
904             throws DOMException JavaDoc {
905         if (fDelegate != null) {
906             return fDelegate.renameNode(arg0, arg1, arg2);
907         } else {
908             return fDocument.renameNode(arg0, arg1, arg2);
909         }
910     }
911     /* (non-Javadoc)
912      * @see org.w3c.dom.Document#setDocumentURI(java.lang.String)
913      */

914     public void setDocumentURI(String JavaDoc arg0) {
915         if (fDelegate != null) {
916             fDelegate.setDocumentURI(arg0);
917         } else {
918             fDocument.setDocumentURI(arg0);
919         }
920     }
921     /* (non-Javadoc)
922      * @see org.w3c.dom.Document#setXmlStandalone(boolean)
923      */

924     public void setXmlStandalone(boolean arg0) throws DOMException JavaDoc {
925         if (fDelegate != null) {
926             fDelegate.setXmlStandalone(arg0);
927         } else {
928             fDocument.setXmlStandalone(arg0);
929         }
930     }
931     /* (non-Javadoc)
932      * @see org.w3c.dom.Document#setXmlVersion(java.lang.String)
933      */

934     public void setXmlVersion(String JavaDoc arg0) throws DOMException JavaDoc {
935         if (fDelegate != null) {
936             fDelegate.setXmlVersion(arg0);
937         } else {
938             fDocument.setXmlVersion(arg0);
939         }
940     }
941     /* (non-Javadoc)
942      * @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node)
943      */

944     public short compareDocumentPosition(Node JavaDoc arg0) throws DOMException JavaDoc {
945         if (fDelegate != null) {
946             return fDelegate.compareDocumentPosition(arg0);
947         } else {
948             return fDocument.compareDocumentPosition(arg0);
949         }
950     }
951     /* (non-Javadoc)
952      * @see org.w3c.dom.Node#getBaseURI()
953      */

954     public String JavaDoc getBaseURI() {
955         if (fDelegate != null) {
956             return fDelegate.getBaseURI();
957         } else {
958             return fDocument.getBaseURI();
959         }
960     }
961     /* (non-Javadoc)
962      * @see org.w3c.dom.Node#getFeature(java.lang.String, java.lang.String)
963      */

964     public Object JavaDoc getFeature(String JavaDoc arg0, String JavaDoc arg1) {
965         if (fDelegate != null) {
966             return fDelegate.getFeature(arg0, arg1);
967         } else {
968             return fDocument.getFeature(arg0, arg1);
969         }
970     }
971     /* (non-Javadoc)
972      * @see org.w3c.dom.Node#getTextContent()
973      */

974     public String JavaDoc getTextContent() throws DOMException JavaDoc {
975         if (fDelegate != null) {
976             return fDelegate.getTextContent();
977         } else {
978             return fDocument.getTextContent();
979         }
980     }
981     /* (non-Javadoc)
982      * @see org.w3c.dom.Node#getUserData(java.lang.String)
983      */

984     public Object JavaDoc getUserData(String JavaDoc arg0) {
985         if (fDelegate != null) {
986             return fDelegate.getUserData(arg0);
987         } else {
988             return fDocument.getUserData(arg0);
989         }
990     }
991     /* (non-Javadoc)
992      * @see org.w3c.dom.Node#isDefaultNamespace(java.lang.String)
993      */

994     public boolean isDefaultNamespace(String JavaDoc arg0) {
995         if (fDelegate != null) {
996             return fDelegate.isDefaultNamespace(arg0);
997         } else {
998             return fDocument.isDefaultNamespace(arg0);
999         }
1000    }
1001    /* (non-Javadoc)
1002     * @see org.w3c.dom.Node#isEqualNode(org.w3c.dom.Node)
1003     */

1004    public boolean isEqualNode(Node JavaDoc arg0) {
1005        if (fDelegate != null) {
1006            return fDelegate.isEqualNode(arg0);
1007        } else {
1008            return fDocument.isEqualNode(arg0);
1009        }
1010    }
1011    /* (non-Javadoc)
1012     * @see org.w3c.dom.Node#isSameNode(org.w3c.dom.Node)
1013     */

1014    public boolean isSameNode(Node JavaDoc arg0) {
1015        if (fDelegate != null) {
1016            return fDelegate.isSameNode(arg0);
1017        } else {
1018            return fDocument.isSameNode(arg0);
1019        }
1020    }
1021    /* (non-Javadoc)
1022     * @see org.w3c.dom.Node#lookupNamespaceURI(java.lang.String)
1023     */

1024    public String JavaDoc lookupNamespaceURI(String JavaDoc arg0) {
1025        if (fDelegate != null) {
1026            return fDelegate.lookupNamespaceURI(arg0);
1027        } else {
1028            return fDocument.lookupNamespaceURI(arg0);
1029        }
1030    }
1031    /* (non-Javadoc)
1032     * @see org.w3c.dom.Node#lookupPrefix(java.lang.String)
1033     */

1034    public String JavaDoc lookupPrefix(String JavaDoc arg0) {
1035        if (fDelegate != null) {
1036            return fDelegate.lookupPrefix(arg0);
1037        } else {
1038            return fDocument.lookupPrefix(arg0);
1039        }
1040    }
1041    /* (non-Javadoc)
1042     * @see org.w3c.dom.Node#setTextContent(java.lang.String)
1043     */

1044    public void setTextContent(String JavaDoc arg0) throws DOMException JavaDoc {
1045        if (fDelegate != null) {
1046            fDelegate.setTextContent(arg0);
1047        } else {
1048            fDocument.setTextContent(arg0);
1049        }
1050    }
1051    /* (non-Javadoc)
1052     * @see org.w3c.dom.Node#setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler)
1053     */

1054    public Object JavaDoc setUserData(String JavaDoc arg0, Object JavaDoc arg1, UserDataHandler JavaDoc arg2) {
1055        if (fDelegate != null) {
1056            return fDelegate.setUserData(arg0, arg1, arg2);
1057        } else {
1058            return fDocument.setUserData(arg0, arg1, arg2);
1059        }
1060    }
1061
1062}
1063
Popular Tags