KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > xsltc > dom > AdaptiveResultTreeImpl


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: AdaptiveResultTreeImpl.java,v 1.7 2004/02/19 23:17:45 igorh Exp $
18  */

19 package org.apache.xalan.xsltc.dom;
20
21 import org.apache.xalan.xsltc.DOM;
22 import org.apache.xalan.xsltc.TransletException;
23 import org.apache.xalan.xsltc.StripFilter;
24 import org.apache.xalan.xsltc.runtime.Hashtable;
25 import org.apache.xalan.xsltc.runtime.BasisLibrary;
26 import org.apache.xalan.xsltc.runtime.AttributeList;
27
28 import org.apache.xml.dtm.DTMAxisIterator;
29 import org.apache.xml.dtm.DTMAxisTraverser;
30 import org.apache.xml.dtm.DTMWSFilter;
31 import org.apache.xml.utils.XMLString;
32
33 import org.apache.xml.serializer.SerializationHandler;
34
35 import javax.xml.transform.SourceLocator JavaDoc;
36 import org.w3c.dom.Node JavaDoc;
37 import org.w3c.dom.NodeList JavaDoc;
38 import org.xml.sax.Attributes JavaDoc;
39 import org.xml.sax.SAXException JavaDoc;
40
41 /**
42  * AdaptiveResultTreeImpl is a adaptive DOM model for result tree fragments (RTF). It is
43  * used in the case where the RTF is likely to be pure text yet it can still be a DOM tree.
44  * It is designed for RTFs which have <xsl:call-template> or <xsl:apply-templates> in
45  * the contents. Example:
46  * <pre>
47  * &lt;xsl:variable name = "x"&gt;
48  * &lt;xsl:call-template name = "test"&gt;
49  * &lt;xsl:with-param name="a" select="."/&gt;
50  * &lt;/xsl:call-template&gt;
51  * &lt;/xsl:variable>
52  * </pre>
53  * <p>In this example the result produced by <xsl:call-template> is likely to be a single
54  * Text node. But it can also be a DOM tree. This kind of RTF cannot be modelled by
55  * SimpleResultTreeImpl.
56  * <p>
57  * AdaptiveResultTreeImpl can be considered as a smart switcher between SimpleResultTreeImpl
58  * and SAXImpl. It treats the RTF as simple Text and uses the SimpleResultTreeImpl model
59  * at the beginning. However, if it receives a call which indicates that this is a DOM tree
60  * (e.g. startElement), it will automatically transform itself into a wrapper around a
61  * SAXImpl. In this way we can have a light-weight model when the result only contains
62  * simple text, while at the same time it still works when the RTF is a DOM tree.
63  * <p>
64  * All methods in this class are overridden to delegate the action to the wrapped SAXImpl object
65  * if it is non-null, or delegate the action to the SimpleResultTreeImpl if there is no
66  * wrapped SAXImpl.
67  * <p>
68  * %REVISIT% Can we combine this class with SimpleResultTreeImpl? I think it is possible, but
69  * it will make SimpleResultTreeImpl more expensive. I will use two separate classes at
70  * this time.
71  */

72 public class AdaptiveResultTreeImpl extends SimpleResultTreeImpl
73 {
74     
75     // Document URI index, which increases by 1 at each getDocumentURI() call.
76
private static int _documentURIIndex = 0;
77
78     // The SAXImpl object wrapped by this class, if the RTF is a tree.
79
private SAXImpl _dom;
80     
81     /** The following fields are only used for the nested SAXImpl **/
82     
83     // The whitespace filter
84
private DTMWSFilter _wsfilter;
85     
86     // The size of the RTF
87
private int _initSize;
88     
89     // True if we want to build the ID index table
90
private boolean _buildIdIndex;
91     
92     // The AttributeList
93
private final AttributeList _attributes = new AttributeList();
94     
95     // The element name
96
private String JavaDoc _openElementName;
97     
98     
99     // Create a AdaptiveResultTreeImpl
100
public AdaptiveResultTreeImpl(XSLTCDTMManager dtmManager, int documentID,
101                                   DTMWSFilter wsfilter, int initSize,
102                                   boolean buildIdIndex)
103     {
104         super(dtmManager, documentID);
105         
106         _wsfilter = wsfilter;
107         _initSize = initSize;
108         _buildIdIndex = buildIdIndex;
109     }
110     
111     // Return the DOM object wrapped in this object.
112
public DOM getNestedDOM()
113     {
114         return _dom;
115     }
116         
117     // Return the document ID
118
public int getDocument()
119     {
120         if (_dom != null) {
121             return _dom.getDocument();
122         }
123         else {
124             return super.getDocument();
125         }
126     }
127
128     // Return the String value of the RTF
129
public String JavaDoc getStringValue()
130     {
131         if (_dom != null) {
132             return _dom.getStringValue();
133         }
134         else {
135             return super.getStringValue();
136         }
137     }
138     
139     public DTMAxisIterator getIterator()
140     {
141         if (_dom != null) {
142             return _dom.getIterator();
143         }
144         else {
145             return super.getIterator();
146         }
147     }
148     
149     public DTMAxisIterator getChildren(final int node)
150     {
151         if (_dom != null) {
152             return _dom.getChildren(node);
153         }
154         else {
155             return super.getChildren(node);
156         }
157     }
158     
159     public DTMAxisIterator getTypedChildren(final int type)
160     {
161         if (_dom != null) {
162             return _dom.getTypedChildren(type);
163         }
164         else {
165             return super.getTypedChildren(type);
166         }
167     }
168     
169     public DTMAxisIterator getAxisIterator(final int axis)
170     {
171         if (_dom != null) {
172             return _dom.getAxisIterator(axis);
173         }
174         else {
175             return super.getAxisIterator(axis);
176         }
177     }
178     
179     public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
180     {
181         if (_dom != null) {
182             return _dom.getTypedAxisIterator(axis, type);
183         }
184         else {
185             return super.getTypedAxisIterator(axis, type);
186         }
187     }
188     
189     public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself)
190     {
191         if (_dom != null) {
192             return _dom.getNthDescendant(node, n, includeself);
193         }
194         else {
195             return super.getNthDescendant(node, n, includeself);
196         }
197     }
198     
199     public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns)
200     {
201         if (_dom != null) {
202             return _dom.getNamespaceAxisIterator(axis, ns);
203         }
204         else {
205             return super.getNamespaceAxisIterator(axis, ns);
206         }
207     }
208     
209     public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
210                          String JavaDoc value, boolean op)
211     {
212         if (_dom != null) {
213             return _dom.getNodeValueIterator(iter, returnType, value, op);
214         }
215         else {
216             return super.getNodeValueIterator(iter, returnType, value, op);
217         }
218     }
219     
220     public DTMAxisIterator orderNodes(DTMAxisIterator source, int node)
221     {
222         if (_dom != null) {
223             return _dom.orderNodes(source, node);
224         }
225         else {
226             return super.orderNodes(source, node);
227         }
228     }
229     
230     public String JavaDoc getNodeName(final int node)
231     {
232         if (_dom != null) {
233             return _dom.getNodeName(node);
234         }
235         else {
236             return super.getNodeName(node);
237         }
238     }
239     
240     public String JavaDoc getNodeNameX(final int node)
241     {
242         if (_dom != null) {
243             return _dom.getNodeNameX(node);
244         }
245         else {
246             return super.getNodeNameX(node);
247         }
248     }
249     
250     public String JavaDoc getNamespaceName(final int node)
251     {
252         if (_dom != null) {
253             return _dom.getNamespaceName(node);
254         }
255         else {
256             return super.getNamespaceName(node);
257         }
258     }
259     
260     // Return the expanded type id of a given node
261
public int getExpandedTypeID(final int nodeHandle)
262     {
263         if (_dom != null) {
264             return _dom.getExpandedTypeID(nodeHandle);
265         }
266         else {
267             return super.getExpandedTypeID(nodeHandle);
268         }
269     }
270     
271     public int getNamespaceType(final int node)
272     {
273         if (_dom != null) {
274             return _dom.getNamespaceType(node);
275         }
276         else {
277             return super.getNamespaceType(node);
278         }
279     }
280     
281     public int getParent(final int nodeHandle)
282     {
283         if (_dom != null) {
284             return _dom.getParent(nodeHandle);
285         }
286         else {
287             return super.getParent(nodeHandle);
288         }
289     }
290     
291     public int getAttributeNode(final int gType, final int element)
292     {
293         if (_dom != null) {
294             return _dom.getAttributeNode(gType, element);
295         }
296         else {
297             return super.getAttributeNode(gType, element);
298         }
299     }
300     
301     public String JavaDoc getStringValueX(final int nodeHandle)
302     {
303         if (_dom != null) {
304             return _dom.getStringValueX(nodeHandle);
305         }
306         else {
307             return super.getStringValueX(nodeHandle);
308         }
309     }
310     
311     public void copy(final int node, SerializationHandler handler)
312     throws TransletException
313     {
314         if (_dom != null) {
315             _dom.copy(node, handler);
316         }
317         else {
318             super.copy(node, handler);
319         }
320     }
321     
322     public void copy(DTMAxisIterator nodes, SerializationHandler handler)
323     throws TransletException
324     {
325         if (_dom != null) {
326             _dom.copy(nodes, handler);
327         }
328         else {
329             super.copy(nodes, handler);
330         }
331     }
332     
333     public String JavaDoc shallowCopy(final int node, SerializationHandler handler)
334     throws TransletException
335     {
336         if (_dom != null) {
337             return _dom.shallowCopy(node, handler);
338         }
339         else {
340             return super.shallowCopy(node, handler);
341         }
342     }
343     
344     public boolean lessThan(final int node1, final int node2)
345     {
346         if (_dom != null) {
347             return _dom.lessThan(node1, node2);
348         }
349         else {
350             return super.lessThan(node1, node2);
351         }
352     }
353     
354     /**
355      * Dispatch the character content of a node to an output handler.
356      *
357      * The escape setting should be taken care of when outputting to
358      * a handler.
359      */

360     public void characters(final int node, SerializationHandler handler)
361     throws TransletException
362     {
363         if (_dom != null) {
364             _dom.characters(node, handler);
365         }
366         else {
367             super.characters(node, handler);
368         }
369     }
370     
371     public Node JavaDoc makeNode(int index)
372     {
373         if (_dom != null) {
374             return _dom.makeNode(index);
375         }
376         else {
377             return super.makeNode(index);
378         }
379     }
380     
381     public Node JavaDoc makeNode(DTMAxisIterator iter)
382     {
383         if (_dom != null) {
384             return _dom.makeNode(iter);
385         }
386         else {
387             return super.makeNode(iter);
388         }
389     }
390     
391     public NodeList JavaDoc makeNodeList(int index)
392     {
393         if (_dom != null) {
394             return _dom.makeNodeList(index);
395         }
396         else {
397             return super.makeNodeList(index);
398         }
399     }
400     
401     public NodeList JavaDoc makeNodeList(DTMAxisIterator iter)
402     {
403         if (_dom != null) {
404             return _dom.makeNodeList(iter);
405         }
406         else {
407             return super.makeNodeList(iter);
408         }
409     }
410     
411     public String JavaDoc getLanguage(int node)
412     {
413         if (_dom != null) {
414             return _dom.getLanguage(node);
415         }
416         else {
417             return super.getLanguage(node);
418         }
419     }
420     
421     public int getSize()
422     {
423         if (_dom != null) {
424             return _dom.getSize();
425         }
426         else {
427             return super.getSize();
428         }
429     }
430     
431     public String JavaDoc getDocumentURI(int node)
432     {
433         if (_dom != null) {
434             return _dom.getDocumentURI(node);
435         }
436         else {
437             return "adaptive_rtf" + _documentURIIndex++;
438         }
439     }
440     
441     public void setFilter(StripFilter filter)
442     {
443         if (_dom != null) {
444             _dom.setFilter(filter);
445         }
446         else {
447             super.setFilter(filter);
448         }
449     }
450     
451     public void setupMapping(String JavaDoc[] names, String JavaDoc[] uris, int[] types, String JavaDoc[] namespaces)
452     {
453         if (_dom != null) {
454             _dom.setupMapping(names, uris, types, namespaces);
455         }
456         else {
457             super.setupMapping(names, uris, types, namespaces);
458         }
459     }
460     
461     public boolean isElement(final int node)
462     {
463         if (_dom != null) {
464             return _dom.isElement(node);
465         }
466         else {
467             return super.isElement(node);
468         }
469     }
470     
471     public boolean isAttribute(final int node)
472     {
473         if (_dom != null) {
474             return _dom.isAttribute(node);
475         }
476         else {
477             return super.isAttribute(node);
478         }
479     }
480     
481     public String JavaDoc lookupNamespace(int node, String JavaDoc prefix)
482     throws TransletException
483     {
484         if (_dom != null) {
485             return _dom.lookupNamespace(node, prefix);
486         }
487         else {
488             return super.lookupNamespace(node, prefix);
489         }
490     }
491     
492     /**
493      * Return the node identity from a node handle.
494      */

495     public final int getNodeIdent(final int nodehandle)
496     {
497         if (_dom != null) {
498             return _dom.getNodeIdent(nodehandle);
499         }
500         else {
501             return super.getNodeIdent(nodehandle);
502         }
503     }
504     
505     /**
506      * Return the node handle from a node identity.
507      */

508     public final int getNodeHandle(final int nodeId)
509     {
510         if (_dom != null) {
511             return _dom.getNodeHandle(nodeId);
512         }
513         else {
514             return super.getNodeHandle(nodeId);
515         }
516     }
517     
518     public DOM getResultTreeFrag(int initialSize, int rtfType)
519     {
520         if (_dom != null) {
521             return _dom.getResultTreeFrag(initialSize, rtfType);
522         }
523         else {
524             return super.getResultTreeFrag(initialSize, rtfType);
525         }
526     }
527     
528     public SerializationHandler getOutputDomBuilder()
529     {
530         return this;
531     }
532     
533     public int getNSType(int node)
534     {
535         if (_dom != null) {
536             return _dom.getNSType(node);
537         }
538         else {
539             return super.getNSType(node);
540         }
541     }
542     
543     public String JavaDoc getUnparsedEntityURI(String JavaDoc name)
544     {
545         if (_dom != null) {
546             return _dom.getUnparsedEntityURI(name);
547         }
548         else {
549             return super.getUnparsedEntityURI(name);
550         }
551     }
552     
553     public Hashtable getElementsWithIDs()
554     {
555         if (_dom != null) {
556             return _dom.getElementsWithIDs();
557         }
558         else {
559             return super.getElementsWithIDs();
560         }
561     }
562
563     /** Implementation of the SerializationHandler interfaces **/
564         
565     /** The code in some of the following interfaces are copied from SAXAdapter. **/
566     
567     private void maybeEmitStartElement() throws SAXException JavaDoc
568     {
569     if (_openElementName != null) {
570
571        int index;
572        if ((index =_openElementName.indexOf(":")) < 0)
573            _dom.startElement(null, _openElementName, _openElementName, _attributes);
574        else
575            _dom.startElement(null, _openElementName.substring(index+1), _openElementName, _attributes);
576
577
578         _openElementName = null;
579     }
580     }
581     
582     // Create and initialize the wrapped SAXImpl object
583
private void prepareNewDOM() throws SAXException JavaDoc
584     {
585         _dom = (SAXImpl)_dtmManager.getDTM(null, true, _wsfilter,
586                                   true, false, false,
587                                   _initSize, _buildIdIndex);
588         _dom.startDocument();
589         // Flush pending Text nodes to SAXImpl
590
for (int i = 0; i < _size; i++) {
591             String JavaDoc str = _textArray[i];
592             _dom.characters(str.toCharArray(), 0, str.length());
593         }
594         _size = 0;
595     }
596     
597     public void startDocument() throws SAXException JavaDoc
598     {
599     }
600     
601     public void endDocument() throws SAXException JavaDoc
602     {
603         if (_dom != null) {
604             _dom.endDocument();
605         }
606         else {
607             super.endDocument();
608         }
609     }
610
611     public void characters(String JavaDoc str) throws SAXException JavaDoc
612     {
613         if (_dom != null) {
614             characters(str.toCharArray(), 0, str.length());
615         }
616         else {
617             super.characters(str);
618         }
619     }
620     
621     public void characters(char[] ch, int offset, int length)
622     throws SAXException JavaDoc
623     {
624         if (_dom != null) {
625         maybeEmitStartElement();
626         _dom.characters(ch, offset, length);
627         }
628         else {
629             super.characters(ch, offset, length);
630         }
631     }
632     
633     public boolean setEscaping(boolean escape) throws SAXException JavaDoc
634     {
635         if (_dom != null) {
636             return _dom.setEscaping(escape);
637         }
638         else {
639             return super.setEscaping(escape);
640         }
641     }
642     
643     public void startElement(String JavaDoc elementName) throws SAXException JavaDoc
644     {
645         if (_dom == null) {
646             prepareNewDOM();
647         }
648                     
649     maybeEmitStartElement();
650     _openElementName = elementName;
651     _attributes.clear();
652     }
653
654     public void startElement(String JavaDoc uri, String JavaDoc localName, String JavaDoc qName)
655         throws SAXException JavaDoc
656     {
657         startElement(qName);
658     }
659
660     public void startElement(String JavaDoc uri, String JavaDoc localName, String JavaDoc qName, Attributes JavaDoc attributes)
661         throws SAXException JavaDoc
662     {
663         startElement(qName);
664     }
665     
666     public void endElement(String JavaDoc elementName) throws SAXException JavaDoc
667     {
668     maybeEmitStartElement();
669     _dom.endElement(null, null, elementName);
670     }
671
672     public void endElement(String JavaDoc uri, String JavaDoc localName, String JavaDoc qName)
673         throws SAXException JavaDoc
674     {
675         endElement(qName);
676     }
677
678  public void addUniqueAttribute(String JavaDoc qName, String JavaDoc value, int flags)
679         throws SAXException JavaDoc
680     {
681         addAttribute(qName, value);
682     }
683
684     public void addAttribute(String JavaDoc name, String JavaDoc value)
685     {
686     if (_openElementName != null) {
687         _attributes.add(name, value);
688     }
689     else {
690         BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, name);
691     }
692     }
693
694     public void namespaceAfterStartElement(String JavaDoc prefix, String JavaDoc uri)
695         throws SAXException JavaDoc
696     {
697     if (_dom == null) {
698        prepareNewDOM();
699     }
700     
701     _dom.startPrefixMapping(prefix, uri);
702     }
703     
704     public void comment(String JavaDoc comment) throws SAXException JavaDoc
705     {
706     if (_dom == null) {
707        prepareNewDOM();
708     }
709     
710     maybeEmitStartElement();
711         char[] chars = comment.toCharArray();
712         _dom.comment(chars, 0, chars.length);
713     }
714
715     public void comment(char[] chars, int offset, int length)
716         throws SAXException JavaDoc
717     {
718     if (_dom == null) {
719        prepareNewDOM();
720     }
721     
722     maybeEmitStartElement();
723         _dom.comment(chars, offset, length);
724     }
725     
726     public void processingInstruction(String JavaDoc target, String JavaDoc data)
727     throws SAXException JavaDoc
728     {
729     if (_dom == null) {
730        prepareNewDOM();
731     }
732     
733     maybeEmitStartElement();
734     _dom.processingInstruction(target, data);
735     }
736     
737     /** Implementation of the DTM interfaces **/
738          
739     public void setFeature(String JavaDoc featureId, boolean state)
740     {
741         if (_dom != null) {
742             _dom.setFeature(featureId, state);
743         }
744     }
745     
746     public void setProperty(String JavaDoc property, Object JavaDoc value)
747     {
748         if (_dom != null) {
749             _dom.setProperty(property, value);
750         }
751     }
752     
753     public DTMAxisTraverser getAxisTraverser(final int axis)
754     {
755         if (_dom != null) {
756             return _dom.getAxisTraverser(axis);
757         }
758         else {
759             return super.getAxisTraverser(axis);
760         }
761     }
762     
763     public boolean hasChildNodes(int nodeHandle)
764     {
765         if (_dom != null) {
766             return _dom.hasChildNodes(nodeHandle);
767         }
768         else {
769             return super.hasChildNodes(nodeHandle);
770         }
771     }
772     
773     public int getFirstChild(int nodeHandle)
774     {
775         if (_dom != null) {
776             return _dom.getFirstChild(nodeHandle);
777         }
778         else {
779             return super.getFirstChild(nodeHandle);
780         }
781     }
782     
783     public int getLastChild(int nodeHandle)
784     {
785         if (_dom != null) {
786             return _dom.getLastChild(nodeHandle);
787         }
788         else {
789             return super.getLastChild(nodeHandle);
790         }
791     }
792     
793     public int getAttributeNode(int elementHandle, String JavaDoc namespaceURI, String JavaDoc name)
794     {
795         if (_dom != null) {
796             return _dom.getAttributeNode(elementHandle, namespaceURI, name);
797         }
798         else {
799             return super.getAttributeNode(elementHandle, namespaceURI, name);
800         }
801     }
802     
803     public int getFirstAttribute(int nodeHandle)
804     {
805         if (_dom != null) {
806             return _dom.getFirstAttribute(nodeHandle);
807         }
808         else {
809             return super.getFirstAttribute(nodeHandle);
810         }
811     }
812     
813     public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
814     {
815         if (_dom != null) {
816             return _dom.getFirstNamespaceNode(nodeHandle, inScope);
817         }
818         else {
819             return super.getFirstNamespaceNode(nodeHandle, inScope);
820         }
821     }
822     
823     public int getNextSibling(int nodeHandle)
824     {
825         if (_dom != null) {
826             return _dom.getNextSibling(nodeHandle);
827         }
828         else {
829             return super.getNextSibling(nodeHandle);
830         }
831      }
832     
833     public int getPreviousSibling(int nodeHandle)
834     {
835         if (_dom != null) {
836             return _dom.getPreviousSibling(nodeHandle);
837         }
838         else {
839             return super.getPreviousSibling(nodeHandle);
840         }
841      }
842     
843     public int getNextAttribute(int nodeHandle)
844     {
845         if (_dom != null) {
846             return _dom.getNextAttribute(nodeHandle);
847         }
848         else {
849             return super.getNextAttribute(nodeHandle);
850         }
851     }
852     
853     public int getNextNamespaceNode(int baseHandle, int namespaceHandle,
854                                   boolean inScope)
855     {
856         if (_dom != null) {
857             return _dom.getNextNamespaceNode(baseHandle, namespaceHandle, inScope);
858         }
859         else {
860             return super.getNextNamespaceNode(baseHandle, namespaceHandle, inScope);
861         }
862     }
863     
864     public int getOwnerDocument(int nodeHandle)
865     {
866         if (_dom != null) {
867             return _dom.getOwnerDocument(nodeHandle);
868         }
869         else {
870             return super.getOwnerDocument(nodeHandle);
871         }
872     }
873     
874     public int getDocumentRoot(int nodeHandle)
875     {
876         if (_dom != null) {
877             return _dom.getDocumentRoot(nodeHandle);
878         }
879         else {
880             return super.getDocumentRoot(nodeHandle);
881         }
882     }
883     
884     public XMLString getStringValue(int nodeHandle)
885     {
886         if (_dom != null) {
887             return _dom.getStringValue(nodeHandle);
888         }
889         else {
890             return super.getStringValue(nodeHandle);
891         }
892     }
893     
894     public int getStringValueChunkCount(int nodeHandle)
895     {
896         if (_dom != null) {
897             return _dom.getStringValueChunkCount(nodeHandle);
898         }
899         else {
900             return super.getStringValueChunkCount(nodeHandle);
901         }
902     }
903     
904     public char[] getStringValueChunk(int nodeHandle, int chunkIndex,
905                                     int[] startAndLen)
906     {
907         if (_dom != null) {
908             return _dom.getStringValueChunk(nodeHandle, chunkIndex, startAndLen);
909         }
910         else {
911             return super.getStringValueChunk(nodeHandle, chunkIndex, startAndLen);
912         }
913     }
914     
915     public int getExpandedTypeID(String JavaDoc namespace, String JavaDoc localName, int type)
916     {
917         if (_dom != null) {
918             return _dom.getExpandedTypeID(namespace, localName, type);
919         }
920         else {
921             return super.getExpandedTypeID(namespace, localName, type);
922         }
923     }
924     
925     public String JavaDoc getLocalNameFromExpandedNameID(int ExpandedNameID)
926     {
927         if (_dom != null) {
928             return _dom.getLocalNameFromExpandedNameID(ExpandedNameID);
929         }
930         else {
931             return super.getLocalNameFromExpandedNameID(ExpandedNameID);
932         }
933     }
934     
935     public String JavaDoc getNamespaceFromExpandedNameID(int ExpandedNameID)
936     {
937         if (_dom != null) {
938             return _dom.getNamespaceFromExpandedNameID(ExpandedNameID);
939         }
940         else {
941             return super.getNamespaceFromExpandedNameID(ExpandedNameID);
942         }
943     }
944     
945     public String JavaDoc getLocalName(int nodeHandle)
946     {
947         if (_dom != null) {
948             return _dom.getLocalName(nodeHandle);
949         }
950         else {
951             return super.getLocalName(nodeHandle);
952         }
953     }
954     
955     public String JavaDoc getPrefix(int nodeHandle)
956     {
957         if (_dom != null) {
958             return _dom.getPrefix(nodeHandle);
959         }
960         else {
961             return super.getPrefix(nodeHandle);
962         }
963     }
964     
965     public String JavaDoc getNamespaceURI(int nodeHandle)
966     {
967         if (_dom != null) {
968             return _dom.getNamespaceURI(nodeHandle);
969         }
970         else {
971             return super.getNamespaceURI(nodeHandle);
972         }
973     }
974     
975     public String JavaDoc getNodeValue(int nodeHandle)
976     {
977         if (_dom != null) {
978             return _dom.getNodeValue(nodeHandle);
979         }
980         else {
981             return super.getNodeValue(nodeHandle);
982         }
983     }
984     
985     public short getNodeType(int nodeHandle)
986     {
987         if (_dom != null) {
988             return _dom.getNodeType(nodeHandle);
989         }
990         else {
991             return super.getNodeType(nodeHandle);
992         }
993     }
994     
995     public short getLevel(int nodeHandle)
996     {
997         if (_dom != null) {
998             return _dom.getLevel(nodeHandle);
999         }
1000        else {
1001            return super.getLevel(nodeHandle);
1002        }
1003    }
1004    
1005    public boolean isSupported(String JavaDoc feature, String JavaDoc version)
1006    {
1007        if (_dom != null) {
1008            return _dom.isSupported(feature, version);
1009        }
1010        else {
1011            return super.isSupported(feature, version);
1012        }
1013    }
1014    
1015    public String JavaDoc getDocumentBaseURI()
1016    {
1017        if (_dom != null) {
1018            return _dom.getDocumentBaseURI();
1019        }
1020        else {
1021            return super.getDocumentBaseURI();
1022        }
1023    }
1024    
1025    public void setDocumentBaseURI(String JavaDoc baseURI)
1026    {
1027        if (_dom != null) {
1028            _dom.setDocumentBaseURI(baseURI);
1029        }
1030        else {
1031            super.setDocumentBaseURI(baseURI);
1032        }
1033    }
1034    
1035    public String JavaDoc getDocumentSystemIdentifier(int nodeHandle)
1036    {
1037        if (_dom != null) {
1038            return _dom.getDocumentSystemIdentifier(nodeHandle);
1039        }
1040        else {
1041            return super.getDocumentSystemIdentifier(nodeHandle);
1042        }
1043    }
1044    
1045    public String JavaDoc getDocumentEncoding(int nodeHandle)
1046    {
1047        if (_dom != null) {
1048            return _dom.getDocumentEncoding(nodeHandle);
1049        }
1050        else {
1051            return super.getDocumentEncoding(nodeHandle);
1052        }
1053    }
1054    
1055    public String JavaDoc getDocumentStandalone(int nodeHandle)
1056    {
1057        if (_dom != null) {
1058            return _dom.getDocumentStandalone(nodeHandle);
1059        }
1060        else {
1061            return super.getDocumentStandalone(nodeHandle);
1062        }
1063    }
1064    
1065    public String JavaDoc getDocumentVersion(int documentHandle)
1066    {
1067        if (_dom != null) {
1068            return _dom.getDocumentVersion(documentHandle);
1069        }
1070        else {
1071            return super.getDocumentVersion(documentHandle);
1072        }
1073    }
1074    
1075    public boolean getDocumentAllDeclarationsProcessed()
1076    {
1077        if (_dom != null) {
1078            return _dom.getDocumentAllDeclarationsProcessed();
1079        }
1080        else {
1081            return super.getDocumentAllDeclarationsProcessed();
1082        }
1083    }
1084    
1085    public String JavaDoc getDocumentTypeDeclarationSystemIdentifier()
1086    {
1087        if (_dom != null) {
1088            return _dom.getDocumentTypeDeclarationSystemIdentifier();
1089        }
1090        else {
1091            return super.getDocumentTypeDeclarationSystemIdentifier();
1092        }
1093    }
1094    
1095    public String JavaDoc getDocumentTypeDeclarationPublicIdentifier()
1096    {
1097        if (_dom != null) {
1098            return _dom.getDocumentTypeDeclarationPublicIdentifier();
1099        }
1100        else {
1101            return super.getDocumentTypeDeclarationPublicIdentifier();
1102        }
1103    }
1104    
1105    public int getElementById(String JavaDoc elementId)
1106    {
1107        if (_dom != null) {
1108            return _dom.getElementById(elementId);
1109        }
1110        else {
1111            return super.getElementById(elementId);
1112        }
1113    }
1114        
1115    public boolean supportsPreStripping()
1116    {
1117        if (_dom != null) {
1118            return _dom.supportsPreStripping();
1119        }
1120        else {
1121            return super.supportsPreStripping();
1122        }
1123    }
1124    
1125    public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle)
1126    {
1127        if (_dom != null) {
1128            return _dom.isNodeAfter(firstNodeHandle, secondNodeHandle);
1129        }
1130        else {
1131            return super.isNodeAfter(firstNodeHandle, secondNodeHandle);
1132        }
1133    }
1134    
1135    public boolean isCharacterElementContentWhitespace(int nodeHandle)
1136    {
1137        if (_dom != null) {
1138            return _dom.isCharacterElementContentWhitespace(nodeHandle);
1139        }
1140        else {
1141            return super.isCharacterElementContentWhitespace(nodeHandle);
1142        }
1143    }
1144    
1145    public boolean isDocumentAllDeclarationsProcessed(int documentHandle)
1146    {
1147        if (_dom != null) {
1148            return _dom.isDocumentAllDeclarationsProcessed(documentHandle);
1149        }
1150        else {
1151            return super.isDocumentAllDeclarationsProcessed(documentHandle);
1152        }
1153    }
1154    
1155    public boolean isAttributeSpecified(int attributeHandle)
1156    {
1157        if (_dom != null) {
1158            return _dom.isAttributeSpecified(attributeHandle);
1159        }
1160        else {
1161            return super.isAttributeSpecified(attributeHandle);
1162        }
1163    }
1164    
1165    public void dispatchCharactersEvents(int nodeHandle, org.xml.sax.ContentHandler JavaDoc ch,
1166                                         boolean normalize)
1167          throws org.xml.sax.SAXException JavaDoc
1168    {
1169        if (_dom != null) {
1170            _dom.dispatchCharactersEvents(nodeHandle, ch, normalize);
1171        }
1172        else {
1173            super.dispatchCharactersEvents(nodeHandle, ch, normalize);
1174        }
1175    }
1176    
1177    public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler JavaDoc ch)
1178      throws org.xml.sax.SAXException JavaDoc
1179    {
1180        if (_dom != null) {
1181            _dom.dispatchToEvents(nodeHandle, ch);
1182        }
1183        else {
1184            super.dispatchToEvents(nodeHandle, ch);
1185        }
1186    }
1187    
1188    public org.w3c.dom.Node JavaDoc getNode(int nodeHandle)
1189    {
1190        if (_dom != null) {
1191            return _dom.getNode(nodeHandle);
1192        }
1193        else {
1194            return super.getNode(nodeHandle);
1195        }
1196    }
1197    
1198    public boolean needsTwoThreads()
1199    {
1200        if (_dom != null) {
1201            return _dom.needsTwoThreads();
1202        }
1203        else {
1204            return super.needsTwoThreads();
1205        }
1206    }
1207    
1208    public org.xml.sax.ContentHandler JavaDoc getContentHandler()
1209    {
1210        if (_dom != null) {
1211            return _dom.getContentHandler();
1212        }
1213        else {
1214            return super.getContentHandler();
1215        }
1216    }
1217    
1218    public org.xml.sax.ext.LexicalHandler JavaDoc getLexicalHandler()
1219    {
1220        if (_dom != null) {
1221            return _dom.getLexicalHandler();
1222        }
1223        else {
1224            return super.getLexicalHandler();
1225        }
1226    }
1227    
1228    public org.xml.sax.EntityResolver JavaDoc getEntityResolver()
1229    {
1230        if (_dom != null) {
1231            return _dom.getEntityResolver();
1232        }
1233        else {
1234            return super.getEntityResolver();
1235        }
1236    }
1237    
1238    public org.xml.sax.DTDHandler JavaDoc getDTDHandler()
1239    {
1240        if (_dom != null) {
1241            return _dom.getDTDHandler();
1242        }
1243        else {
1244            return super.getDTDHandler();
1245        }
1246    }
1247    
1248    public org.xml.sax.ErrorHandler JavaDoc getErrorHandler()
1249    {
1250        if (_dom != null) {
1251            return _dom.getErrorHandler();
1252        }
1253        else {
1254            return super.getErrorHandler();
1255        }
1256    }
1257    
1258    public org.xml.sax.ext.DeclHandler JavaDoc getDeclHandler()
1259    {
1260        if (_dom != null) {
1261            return _dom.getDeclHandler();
1262        }
1263        else {
1264            return super.getDeclHandler();
1265        }
1266    }
1267    
1268    public void appendChild(int newChild, boolean clone, boolean cloneDepth)
1269    {
1270        if (_dom != null) {
1271            _dom.appendChild(newChild, clone, cloneDepth);
1272        }
1273        else {
1274            super.appendChild(newChild, clone, cloneDepth);
1275        }
1276    }
1277    
1278    public void appendTextChild(String JavaDoc str)
1279    {
1280        if (_dom != null) {
1281            _dom.appendTextChild(str);
1282        }
1283        else {
1284            super.appendTextChild(str);
1285        }
1286    }
1287    
1288    public SourceLocator JavaDoc getSourceLocatorFor(int node)
1289    {
1290        if (_dom != null) {
1291            return _dom.getSourceLocatorFor(node);
1292        }
1293        else {
1294            return super.getSourceLocatorFor(node);
1295        }
1296    }
1297    
1298    public void documentRegistration()
1299    {
1300        if (_dom != null) {
1301            _dom.documentRegistration();
1302        }
1303        else {
1304            super.documentRegistration();
1305        }
1306    }
1307    
1308    public void documentRelease()
1309    {
1310        if (_dom != null) {
1311            _dom.documentRelease();
1312        }
1313        else {
1314            super.documentRelease();
1315        }
1316    }
1317
1318}
1319
Popular Tags