KickJava   Java API By Example, From Geeks To Geeks.

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