001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 /*
019 * $Id: AdaptiveResultTreeImpl.java 468651 2006-10-28 07:04:25Z minchau $
020 */
021 package org.apache.xalan.xsltc.dom;
022
023 import org.apache.xalan.xsltc.DOM;
024 import org.apache.xalan.xsltc.TransletException;
025 import org.apache.xalan.xsltc.StripFilter;
026 import org.apache.xalan.xsltc.runtime.Hashtable;
027 import org.apache.xalan.xsltc.runtime.BasisLibrary;
028 import org.apache.xalan.xsltc.runtime.AttributeList;
029
030 import org.apache.xml.dtm.DTMAxisIterator;
031 import org.apache.xml.dtm.DTMAxisTraverser;
032 import org.apache.xml.dtm.DTMWSFilter;
033 import org.apache.xml.utils.XMLString;
034
035 import org.apache.xml.serializer.SerializationHandler;
036
037 import javax.xml.transform.SourceLocator;
038 import org.w3c.dom.Node;
039 import org.w3c.dom.NodeList;
040 import org.xml.sax.Attributes;
041 import org.xml.sax.SAXException;
042
043 /**
044 * AdaptiveResultTreeImpl is a adaptive DOM model for result tree fragments (RTF). It is
045 * used in the case where the RTF is likely to be pure text yet it can still be a DOM tree.
046 * It is designed for RTFs which have <xsl:call-template> or <xsl:apply-templates> in
047 * the contents. Example:
048 * <pre>
049 * <xsl:variable name = "x">
050 * <xsl:call-template name = "test">
051 * <xsl:with-param name="a" select="."/>
052 * </xsl:call-template>
053 * </xsl:variable>
054 * </pre>
055 * <p>In this example the result produced by <xsl:call-template> is likely to be a single
056 * Text node. But it can also be a DOM tree. This kind of RTF cannot be modelled by
057 * SimpleResultTreeImpl.
058 * <p>
059 * AdaptiveResultTreeImpl can be considered as a smart switcher between SimpleResultTreeImpl
060 * and SAXImpl. It treats the RTF as simple Text and uses the SimpleResultTreeImpl model
061 * at the beginning. However, if it receives a call which indicates that this is a DOM tree
062 * (e.g. startElement), it will automatically transform itself into a wrapper around a
063 * SAXImpl. In this way we can have a light-weight model when the result only contains
064 * simple text, while at the same time it still works when the RTF is a DOM tree.
065 * <p>
066 * All methods in this class are overridden to delegate the action to the wrapped SAXImpl object
067 * if it is non-null, or delegate the action to the SimpleResultTreeImpl if there is no
068 * wrapped SAXImpl.
069 * <p>
070 * %REVISIT% Can we combine this class with SimpleResultTreeImpl? I think it is possible, but
071 * it will make SimpleResultTreeImpl more expensive. I will use two separate classes at
072 * this time.
073 */
074 public class AdaptiveResultTreeImpl extends SimpleResultTreeImpl
075 {
076
077 // Document URI index, which increases by 1 at each getDocumentURI() call.
078 private static int _documentURIIndex = 0;
079
080 // The SAXImpl object wrapped by this class, if the RTF is a tree.
081 private SAXImpl _dom;
082
083 /** The following fields are only used for the nested SAXImpl **/
084
085 // The whitespace filter
086 private DTMWSFilter _wsfilter;
087
088 // The size of the RTF
089 private int _initSize;
090
091 // True if we want to build the ID index table
092 private boolean _buildIdIndex;
093
094 // The AttributeList
095 private final AttributeList _attributes = new AttributeList();
096
097 // The element name
098 private String _openElementName;
099
100
101 // Create a AdaptiveResultTreeImpl
102 public AdaptiveResultTreeImpl(XSLTCDTMManager dtmManager, int documentID,
103 DTMWSFilter wsfilter, int initSize,
104 boolean buildIdIndex)
105 {
106 super(dtmManager, documentID);
107
108 _wsfilter = wsfilter;
109 _initSize = initSize;
110 _buildIdIndex = buildIdIndex;
111 }
112
113 // Return the DOM object wrapped in this object.
114 public DOM getNestedDOM()
115 {
116 return _dom;
117 }
118
119 // Return the document ID
120 public int getDocument()
121 {
122 if (_dom != null) {
123 return _dom.getDocument();
124 }
125 else {
126 return super.getDocument();
127 }
128 }
129
130 // Return the String value of the RTF
131 public String getStringValue()
132 {
133 if (_dom != null) {
134 return _dom.getStringValue();
135 }
136 else {
137 return super.getStringValue();
138 }
139 }
140
141 public DTMAxisIterator getIterator()
142 {
143 if (_dom != null) {
144 return _dom.getIterator();
145 }
146 else {
147 return super.getIterator();
148 }
149 }
150
151 public DTMAxisIterator getChildren(final int node)
152 {
153 if (_dom != null) {
154 return _dom.getChildren(node);
155 }
156 else {
157 return super.getChildren(node);
158 }
159 }
160
161 public DTMAxisIterator getTypedChildren(final int type)
162 {
163 if (_dom != null) {
164 return _dom.getTypedChildren(type);
165 }
166 else {
167 return super.getTypedChildren(type);
168 }
169 }
170
171 public DTMAxisIterator getAxisIterator(final int axis)
172 {
173 if (_dom != null) {
174 return _dom.getAxisIterator(axis);
175 }
176 else {
177 return super.getAxisIterator(axis);
178 }
179 }
180
181 public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
182 {
183 if (_dom != null) {
184 return _dom.getTypedAxisIterator(axis, type);
185 }
186 else {
187 return super.getTypedAxisIterator(axis, type);
188 }
189 }
190
191 public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself)
192 {
193 if (_dom != null) {
194 return _dom.getNthDescendant(node, n, includeself);
195 }
196 else {
197 return super.getNthDescendant(node, n, includeself);
198 }
199 }
200
201 public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns)
202 {
203 if (_dom != null) {
204 return _dom.getNamespaceAxisIterator(axis, ns);
205 }
206 else {
207 return super.getNamespaceAxisIterator(axis, ns);
208 }
209 }
210
211 public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
212 String value, boolean op)
213 {
214 if (_dom != null) {
215 return _dom.getNodeValueIterator(iter, returnType, value, op);
216 }
217 else {
218 return super.getNodeValueIterator(iter, returnType, value, op);
219 }
220 }
221
222 public DTMAxisIterator orderNodes(DTMAxisIterator source, int node)
223 {
224 if (_dom != null) {
225 return _dom.orderNodes(source, node);
226 }
227 else {
228 return super.orderNodes(source, node);
229 }
230 }
231
232 public String getNodeName(final int node)
233 {
234 if (_dom != null) {
235 return _dom.getNodeName(node);
236 }
237 else {
238 return super.getNodeName(node);
239 }
240 }
241
242 public String getNodeNameX(final int node)
243 {
244 if (_dom != null) {
245 return _dom.getNodeNameX(node);
246 }
247 else {
248 return super.getNodeNameX(node);
249 }
250 }
251
252 public String getNamespaceName(final int node)
253 {
254 if (_dom != null) {
255 return _dom.getNamespaceName(node);
256 }
257 else {
258 return super.getNamespaceName(node);
259 }
260 }
261
262 // Return the expanded type id of a given node
263 public int getExpandedTypeID(final int nodeHandle)
264 {
265 if (_dom != null) {
266 return _dom.getExpandedTypeID(nodeHandle);
267 }
268 else {
269 return super.getExpandedTypeID(nodeHandle);
270 }
271 }
272
273 public int getNamespaceType(final int node)
274 {
275 if (_dom != null) {
276 return _dom.getNamespaceType(node);
277 }
278 else {
279 return super.getNamespaceType(node);
280 }
281 }
282
283 public int getParent(final int nodeHandle)
284 {
285 if (_dom != null) {
286 return _dom.getParent(nodeHandle);
287 }
288 else {
289 return super.getParent(nodeHandle);
290 }
291 }
292
293 public int getAttributeNode(final int gType, final int element)
294 {
295 if (_dom != null) {
296 return _dom.getAttributeNode(gType, element);
297 }
298 else {
299 return super.getAttributeNode(gType, element);
300 }
301 }
302
303 public String getStringValueX(final int nodeHandle)
304 {
305 if (_dom != null) {
306 return _dom.getStringValueX(nodeHandle);
307 }
308 else {
309 return super.getStringValueX(nodeHandle);
310 }
311 }
312
313 public void copy(final int node, SerializationHandler handler)
314 throws TransletException
315 {
316 if (_dom != null) {
317 _dom.copy(node, handler);
318 }
319 else {
320 super.copy(node, handler);
321 }
322 }
323
324 public void copy(DTMAxisIterator nodes, SerializationHandler handler)
325 throws TransletException
326 {
327 if (_dom != null) {
328 _dom.copy(nodes, handler);
329 }
330 else {
331 super.copy(nodes, handler);
332 }
333 }
334
335 public String shallowCopy(final int node, SerializationHandler handler)
336 throws TransletException
337 {
338 if (_dom != null) {
339 return _dom.shallowCopy(node, handler);
340 }
341 else {
342 return super.shallowCopy(node, handler);
343 }
344 }
345
346 public boolean lessThan(final int node1, final int node2)
347 {
348 if (_dom != null) {
349 return _dom.lessThan(node1, node2);
350 }
351 else {
352 return super.lessThan(node1, node2);
353 }
354 }
355
356 /**
357 * Dispatch the character content of a node to an output handler.
358 *
359 * The escape setting should be taken care of when outputting to
360 * a handler.
361 */
362 public void characters(final int node, SerializationHandler handler)
363 throws TransletException
364 {
365 if (_dom != null) {
366 _dom.characters(node, handler);
367 }
368 else {
369 super.characters(node, handler);
370 }
371 }
372
373 public Node makeNode(int index)
374 {
375 if (_dom != null) {
376 return _dom.makeNode(index);
377 }
378 else {
379 return super.makeNode(index);
380 }
381 }
382
383 public Node makeNode(DTMAxisIterator iter)
384 {
385 if (_dom != null) {
386 return _dom.makeNode(iter);
387 }
388 else {
389 return super.makeNode(iter);
390 }
391 }
392
393 public NodeList makeNodeList(int index)
394 {
395 if (_dom != null) {
396 return _dom.makeNodeList(index);
397 }
398 else {
399 return super.makeNodeList(index);
400 }
401 }
402
403 public NodeList makeNodeList(DTMAxisIterator iter)
404 {
405 if (_dom != null) {
406 return _dom.makeNodeList(iter);
407 }
408 else {
409 return super.makeNodeList(iter);
410 }
411 }
412
413 public String getLanguage(int node)
414 {
415 if (_dom != null) {
416 return _dom.getLanguage(node);
417 }
418 else {
419 return super.getLanguage(node);
420 }
421 }
422
423 public int getSize()
424 {
425 if (_dom != null) {
426 return _dom.getSize();
427 }
428 else {
429 return super.getSize();
430 }
431 }
432
433 public String getDocumentURI(int node)
434 {
435 if (_dom != null) {
436 return _dom.getDocumentURI(node);
437 }
438 else {
439 return "adaptive_rtf" + _documentURIIndex++;
440 }
441 }
442
443 public void setFilter(StripFilter filter)
444 {
445 if (_dom != null) {
446 _dom.setFilter(filter);
447 }
448 else {
449 super.setFilter(filter);
450 }
451 }
452
453 public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces)
454 {
455 if (_dom != null) {
456 _dom.setupMapping(names, uris, types, namespaces);
457 }
458 else {
459 super.setupMapping(names, uris, types, namespaces);
460 }
461 }
462
463 public boolean isElement(final int node)
464 {
465 if (_dom != null) {
466 return _dom.isElement(node);
467 }
468 else {
469 return super.isElement(node);
470 }
471 }
472
473 public boolean isAttribute(final int node)
474 {
475 if (_dom != null) {
476 return _dom.isAttribute(node);
477 }
478 else {
479 return super.isAttribute(node);
480 }
481 }
482
483 public String lookupNamespace(int node, String prefix)
484 throws TransletException
485 {
486 if (_dom != null) {
487 return _dom.lookupNamespace(node, prefix);
488 }
489 else {
490 return super.lookupNamespace(node, prefix);
491 }
492 }
493
494 /**
495 * Return the node identity from a node handle.
496 */
497 public final int getNodeIdent(final int nodehandle)
498 {
499 if (_dom != null) {
500 return _dom.getNodeIdent(nodehandle);
501 }
502 else {
503 return super.getNodeIdent(nodehandle);
504 }
505 }
506
507 /**
508 * Return the node handle from a node identity.
509 */
510 public final int getNodeHandle(final int nodeId)
511 {
512 if (_dom != null) {
513 return _dom.getNodeHandle(nodeId);
514 }
515 else {
516 return super.getNodeHandle(nodeId);
517 }
518 }
519
520 public DOM getResultTreeFrag(int initialSize, int rtfType)
521 {
522 if (_dom != null) {
523 return _dom.getResultTreeFrag(initialSize, rtfType);
524 }
525 else {
526 return super.getResultTreeFrag(initialSize, rtfType);
527 }
528 }
529
530 public SerializationHandler getOutputDomBuilder()
531 {
532 return this;
533 }
534
535 public int getNSType(int node)
536 {
537 if (_dom != null) {
538 return _dom.getNSType(node);
539 }
540 else {
541 return super.getNSType(node);
542 }
543 }
544
545 public String getUnparsedEntityURI(String name)
546 {
547 if (_dom != null) {
548 return _dom.getUnparsedEntityURI(name);
549 }
550 else {
551 return super.getUnparsedEntityURI(name);
552 }
553 }
554
555 public Hashtable getElementsWithIDs()
556 {
557 if (_dom != null) {
558 return _dom.getElementsWithIDs();
559 }
560 else {
561 return super.getElementsWithIDs();
562 }
563 }
564
565 /** Implementation of the SerializationHandler interfaces **/
566
567 /** The code in some of the following interfaces are copied from SAXAdapter. **/
568
569 private void maybeEmitStartElement() throws SAXException
570 {
571 if (_openElementName != null) {
572
573 int index;
574 if ((index =_openElementName.indexOf(":")) < 0)
575 _dom.startElement(null, _openElementName, _openElementName, _attributes);
576 else
577 _dom.startElement(null, _openElementName.substring(index+1), _openElementName, _attributes);
578
579
580 _openElementName = null;
581 }
582 }
583
584 // Create and initialize the wrapped SAXImpl object
585 private void prepareNewDOM() throws SAXException
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 str = _textArray[i];
594 _dom.characters(str.toCharArray(), 0, str.length());
595 }
596 _size = 0;
597 }
598
599 public void startDocument() throws SAXException
600 {
601 }
602
603 public void endDocument() throws SAXException
604 {
605 if (_dom != null) {
606 _dom.endDocument();
607 }
608 else {
609 super.endDocument();
610 }
611 }
612
613 public void characters(String str) throws SAXException
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
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
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 elementName) throws SAXException
646 {
647 if (_dom == null) {
648 prepareNewDOM();
649 }
650
651 maybeEmitStartElement();
652 _openElementName = elementName;
653 _attributes.clear();
654 }
655
656 public void startElement(String uri, String localName, String qName)
657 throws SAXException
658 {
659 startElement(qName);
660 }
661
662 public void startElement(String uri, String localName, String qName, Attributes attributes)
663 throws SAXException
664 {
665 startElement(qName);
666 }
667
668 public void endElement(String elementName) throws SAXException
669 {
670 maybeEmitStartElement();
671 _dom.endElement(null, null, elementName);
672 }
673
674 public void endElement(String uri, String localName, String qName)
675 throws SAXException
676 {
677 endElement(qName);
678 }
679
680 public void addUniqueAttribute(String qName, String value, int flags)
681 throws SAXException
682 {
683 addAttribute(qName, value);
684 }
685
686 public void addAttribute(String name, String 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 prefix, String uri)
697 throws SAXException
698 {
699 if (_dom == null) {
700 prepareNewDOM();
701 }
702
703 _dom.startPrefixMapping(prefix, uri);
704 }
705
706 public void comment(String comment) throws SAXException
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
719 {
720 if (_dom == null) {
721 prepareNewDOM();
722 }
723
724 maybeEmitStartElement();
725 _dom.comment(chars, offset, length);
726 }
727
728 public void processingInstruction(String target, String data)
729 throws SAXException
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 featureId, boolean state)
742 {
743 if (_dom != null) {
744 _dom.setFeature(featureId, state);
745 }
746 }
747
748 public void setProperty(String property, Object 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 namespaceURI, String 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 namespace, String 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 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 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 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 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 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 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 feature, String 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 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 baseURI)
1028 {
1029 if (_dom != null) {
1030 _dom.setDocumentBaseURI(baseURI);
1031 }
1032 else {
1033 super.setDocumentBaseURI(baseURI);
1034 }
1035 }
1036
1037 public String 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 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 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 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 getDocumentTypeDeclarationSystemIdentifier()
1088 {
1089 if (_dom != null) {
1090 return _dom.getDocumentTypeDeclarationSystemIdentifier();
1091 }
1092 else {
1093 return super.getDocumentTypeDeclarationSystemIdentifier();
1094 }
1095 }
1096
1097 public String 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 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 ch,
1168 boolean normalize)
1169 throws org.xml.sax.SAXException
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 ch)
1180 throws org.xml.sax.SAXException
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 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 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 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 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 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 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 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 str)
1281 {
1282 if (_dom != null) {
1283 _dom.appendTextChild(str);
1284 }
1285 else {
1286 super.appendTextChild(str);
1287 }
1288 }
1289
1290 public SourceLocator 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 }