View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 1999-2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  /*
21   * $Id: SimpleResultTreeImpl.java,v 1.2.4.1 2005/09/06 10:09:25 pvedula Exp $
22   */
23  package com.sun.org.apache.xalan.internal.xsltc.dom;
24  
25  import com.sun.org.apache.xalan.internal.xsltc.DOM;
26  import com.sun.org.apache.xalan.internal.xsltc.TransletException;
27  import com.sun.org.apache.xalan.internal.xsltc.StripFilter;
28  import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
29  
30  import com.sun.org.apache.xml.internal.dtm.DTM;
31  import com.sun.org.apache.xml.internal.dtm.Axis;
32  import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
33  import com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser;
34  import com.sun.org.apache.xml.internal.dtm.DTMManager;
35  import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase;
36  import com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault;
37  import com.sun.org.apache.xml.internal.serializer.EmptySerializer;
38  import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
39  import com.sun.org.apache.xml.internal.utils.XMLString;
40  import com.sun.org.apache.xml.internal.utils.XMLStringDefault;
41  
42  import org.w3c.dom.Node;
43  import org.w3c.dom.NodeList;
44  
45  import org.xml.sax.SAXException;
46  
47  import javax.xml.transform.SourceLocator;
48  
49  /**
50   * This class represents a light-weight DOM model for simple result tree fragment(RTF).
51   * A simple RTF is an RTF that has only one Text node. The Text node can be produced by a
52   * combination of Text, xsl:value-of and xsl:number instructions. It can also be produced
53   * by a control structure (xsl:if or xsl:choose) whose body is pure Text.
54   * <p>
55   * A SimpleResultTreeImpl has only two nodes, i.e. the ROOT node and its Text child. All DOM
56   * interfaces are overridden with this in mind. For example, the getStringValue() interface
57   * returns the value of the Text node. This class receives the character data from the
58   * characters() interface.
59   * <p>
60   * This class implements DOM and SerializationHandler. It also implements the DTM interface
61   * for support in MultiDOM. The nested iterators (SimpleIterator and SingletonIterator) are
62   * used to support the nodeset() extension function.
63   */
64  public class SimpleResultTreeImpl extends EmptySerializer implements DOM, DTM
65  {
66  
67      /**
68       * The SimpleIterator is designed to support the nodeset() extension function. It has
69       * a traversal direction parameter. The DOWN direction is used for child and descendant
70       * axes, while the UP direction is used for parent and ancestor axes.
71       *
72       * This iterator only handles two nodes (RTF_ROOT and RTF_TEXT). If the type is set,
73       * it will also match the node type with the given type.
74       */
75      public final class SimpleIterator extends DTMAxisIteratorBase
76      {
77          static final int DIRECTION_UP = 0;
78          static final int DIRECTION_DOWN = 1;
79          static final int NO_TYPE = -1;
80  
81          // The direction of traversal (default to DOWN).
82          // DOWN is for child and descendant. UP is for parent and ancestor.
83          int _direction = DIRECTION_DOWN;
84  
85          int _type = NO_TYPE;
86          int _currentNode;
87  
88          public SimpleIterator()
89          {
90          }
91  
92          public SimpleIterator(int direction)
93          {
94              _direction = direction;
95          }
96  
97          public SimpleIterator(int direction, int type)
98          {
99               _direction = direction;
100              _type = type;
101         }
102 
103         public int next()
104         {
105             // Increase the node ID for down traversal. Also match the node type
106             // if the type is given.
107             if (_direction == DIRECTION_DOWN) {
108                 while (_currentNode < NUMBER_OF_NODES) {
109                     if (_type != NO_TYPE) {
110                         if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
111                             || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
112                             return returnNode(getNodeHandle(_currentNode++));
113                         else
114                             _currentNode++;
115                     }
116                     else
117                         return returnNode(getNodeHandle(_currentNode++));
118                 }
119 
120                 return END;
121             }
122             // Decrease the node ID for up traversal.
123             else {
124                 while (_currentNode >= 0) {
125                     if (_type != NO_TYPE) {
126                         if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
127                             || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
128                             return returnNode(getNodeHandle(_currentNode--));
129                         else
130                             _currentNode--;
131                     }
132                     else
133                         return returnNode(getNodeHandle(_currentNode--));
134                 }
135 
136                 return END;
137             }
138         }
139 
140         public DTMAxisIterator setStartNode(int nodeHandle)
141         {
142             int nodeID = getNodeIdent(nodeHandle);
143             _startNode = nodeID;
144 
145             // Increase the node ID by 1 if self is not included.
146             if (!_includeSelf && nodeID != DTM.NULL) {
147                 if (_direction == DIRECTION_DOWN)
148                     nodeID++;
149                 else if (_direction == DIRECTION_UP)
150                     nodeID--;
151             }
152 
153             _currentNode = nodeID;
154             return this;
155         }
156 
157         public void setMark()
158         {
159             _markedNode = _currentNode;
160         }
161 
162         public void gotoMark()
163         {
164             _currentNode = _markedNode;
165         }
166 
167     } // END of SimpleIterator
168 
169     /**
170      * The SingletonIterator is used for the self axis.
171      */
172     public final class SingletonIterator extends DTMAxisIteratorBase
173     {
174         static final int NO_TYPE = -1;
175         int _type = NO_TYPE;
176         int _currentNode;
177 
178         public SingletonIterator()
179         {
180         }
181 
182         public SingletonIterator(int type)
183         {
184             _type = type;
185         }
186 
187         public void setMark()
188         {
189             _markedNode = _currentNode;
190         }
191 
192         public void gotoMark()
193         {
194             _currentNode = _markedNode;
195         }
196 
197         public DTMAxisIterator setStartNode(int nodeHandle)
198         {
199             _currentNode = _startNode = getNodeIdent(nodeHandle);
200             return this;
201         }
202 
203         public int next()
204         {
205             if (_currentNode == END)
206                 return END;
207 
208             _currentNode = END;
209 
210             if (_type != NO_TYPE) {
211                 if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
212                     || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
213                     return getNodeHandle(_currentNode);
214             }
215             else
216                 return getNodeHandle(_currentNode);
217 
218             return END;
219         }
220 
221     }  // END of SingletonIterator
222 
223     // empty iterator to be returned when there are no children
224     private final static DTMAxisIterator EMPTY_ITERATOR =
225         new DTMAxisIteratorBase() {
226             public DTMAxisIterator reset() { return this; }
227             public DTMAxisIterator setStartNode(int node) { return this; }
228             public int next() { return DTM.NULL; }
229             public void setMark() {}
230             public void gotoMark() {}
231             public int getLast() { return 0; }
232             public int getPosition() { return 0; }
233             public DTMAxisIterator cloneIterator() { return this; }
234             public void setRestartable(boolean isRestartable) { }
235         };
236 
237 
238     // The root node id of the simple RTF
239     public static final int RTF_ROOT = 0;
240 
241     // The Text node id of the simple RTF (simple RTF has only one Text node).
242     public static final int RTF_TEXT = 1;
243 
244     // The number of nodes.
245     public static final int NUMBER_OF_NODES = 2;
246 
247     // Document URI index, which increases by 1 at each getDocumentURI() call.
248     private static int _documentURIIndex = 0;
249 
250     // Constant for empty String
251     private static final String EMPTY_STR = "";
252 
253     // The String value of the Text node.
254     // This is set at the endDocument() call.
255     private String _text;
256 
257     // The array of Text items, which is built by the characters() call.
258     // The characters() interface can be called multiple times. Each character item
259     // can have different escape settings.
260     protected String[] _textArray;
261 
262     // The DTMManager
263     protected XSLTCDTMManager _dtmManager;
264 
265     // Number of character items
266     protected int _size = 0;
267 
268     // The document ID
269     private int _documentID;
270 
271     // A BitArray, each bit holding the escape setting for a character item.
272     private BitArray _dontEscape = null;
273 
274     // The current escape setting
275     private boolean _escaping = true;
276 
277     // Create a SimpleResultTreeImpl from a DTMManager and a document ID.
278     public SimpleResultTreeImpl(XSLTCDTMManager dtmManager, int documentID)
279     {
280         _dtmManager = dtmManager;
281         _documentID = documentID;
282         _textArray = new String[4];
283     }
284 
285     public DTMManagerDefault getDTMManager()
286     {
287         return _dtmManager;
288     }
289 
290     // Return the document ID
291     public int getDocument()
292     {
293         return _documentID;
294     }
295 
296     // Return the String value of the RTF
297     public String getStringValue()
298     {
299         return _text;
300     }
301 
302     public DTMAxisIterator getIterator()
303     {
304         return new SingletonIterator(getDocument());
305     }
306 
307     public DTMAxisIterator getChildren(final int node)
308     {
309         return new SimpleIterator().setStartNode(node);
310     }
311 
312     public DTMAxisIterator getTypedChildren(final int type)
313     {
314         return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type);
315     }
316 
317     // Return the axis iterator for a given axis.
318     // The SimpleIterator is used for the child, descendant, parent and ancestor axes.
319     public DTMAxisIterator getAxisIterator(final int axis)
320     {
321         switch (axis)
322         {
323             case Axis.CHILD:
324             case Axis.DESCENDANT:
325                 return new SimpleIterator(SimpleIterator.DIRECTION_DOWN);
326             case Axis.PARENT:
327             case Axis.ANCESTOR:
328                 return new SimpleIterator(SimpleIterator.DIRECTION_UP);
329             case Axis.ANCESTORORSELF:
330                 return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf();
331             case Axis.DESCENDANTORSELF:
332                 return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf();
333             case Axis.SELF:
334                 return new SingletonIterator();
335             default:
336                 return EMPTY_ITERATOR;
337         }
338     }
339 
340     public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
341     {
342         switch (axis)
343         {
344             case Axis.CHILD:
345             case Axis.DESCENDANT:
346                 return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type);
347             case Axis.PARENT:
348             case Axis.ANCESTOR:
349                 return new SimpleIterator(SimpleIterator.DIRECTION_UP, type);
350             case Axis.ANCESTORORSELF:
351                 return (new SimpleIterator(SimpleIterator.DIRECTION_UP, type)).includeSelf();
352             case Axis.DESCENDANTORSELF:
353                 return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type)).includeSelf();
354             case Axis.SELF:
355                 return new SingletonIterator(type);
356             default:
357                 return EMPTY_ITERATOR;
358         }
359     }
360 
361     // %REVISIT% Can this one ever get used?
362     public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself)
363     {
364         return null;
365     }
366 
367     public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns)
368     {
369         return null;
370     }
371 
372     // %REVISIT% Can this one ever get used?
373     public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
374                                              String value, boolean op)
375     {
376         return null;
377     }
378 
379     public DTMAxisIterator orderNodes(DTMAxisIterator source, int node)
380     {
381         return source;
382     }
383 
384     public String getNodeName(final int node)
385     {
386         if (getNodeIdent(node) == RTF_TEXT)
387             return "#text";
388         else
389             return EMPTY_STR;
390     }
391 
392     public String getNodeNameX(final int node)
393     {
394         return EMPTY_STR;
395     }
396 
397     public String getNamespaceName(final int node)
398     {
399         return EMPTY_STR;
400     }
401 
402     // Return the expanded type id of a given node
403     public int getExpandedTypeID(final int nodeHandle)
404     {
405         int nodeID = getNodeIdent(nodeHandle);
406         if (nodeID == RTF_TEXT)
407             return DTM.TEXT_NODE;
408         else if (nodeID == RTF_ROOT)
409             return DTM.ROOT_NODE;
410         else
411             return DTM.NULL;
412     }
413 
414     public int getNamespaceType(final int node)
415     {
416         return 0;
417     }
418 
419     public int getParent(final int nodeHandle)
420     {
421         int nodeID = getNodeIdent(nodeHandle);
422         return (nodeID == RTF_TEXT) ? getNodeHandle(RTF_ROOT) : DTM.NULL;
423     }
424 
425     public int getAttributeNode(final int gType, final int element)
426     {
427         return DTM.NULL;
428     }
429 
430     public String getStringValueX(final int nodeHandle)
431     {
432         int nodeID = getNodeIdent(nodeHandle);
433         if (nodeID == RTF_ROOT || nodeID == RTF_TEXT)
434             return _text;
435         else
436             return EMPTY_STR;
437     }
438 
439     public void copy(final int node, SerializationHandler handler)
440         throws TransletException
441     {
442         characters(node, handler);
443     }
444 
445     public void copy(DTMAxisIterator nodes, SerializationHandler handler)
446         throws TransletException
447     {
448         int node;
449         while ((node = nodes.next()) != DTM.NULL)
450         {
451             copy(node, handler);
452         }
453     }
454 
455     public String shallowCopy(final int node, SerializationHandler handler)
456         throws TransletException
457     {
458         characters(node, handler);
459         return null;
460     }
461 
462     public boolean lessThan(final int node1, final int node2)
463     {
464         if (node1 == DTM.NULL) {
465             return false;
466         }
467         else if (node2 == DTM.NULL) {
468             return true;
469         }
470         else
471             return (node1 < node2);
472     }
473 
474     /**
475      * Dispatch the character content of a node to an output handler.
476      *
477      * The escape setting should be taken care of when outputting to
478      * a handler.
479      */
480     public void characters(final int node, SerializationHandler handler)
481         throws TransletException
482     {
483         int nodeID = getNodeIdent(node);
484         if (nodeID == RTF_ROOT || nodeID == RTF_TEXT) {
485             boolean escapeBit = false;
486             boolean oldEscapeSetting = false;
487 
488             try {
489                 for (int i = 0; i < _size; i++) {
490 
491                     if (_dontEscape != null) {
492                         escapeBit = _dontEscape.getBit(i);
493                         if (escapeBit) {
494                             oldEscapeSetting = handler.setEscaping(false);
495                         }
496                     }
497 
498                     handler.characters(_textArray[i]);
499 
500                     if (escapeBit) {
501                         handler.setEscaping(oldEscapeSetting);
502                     }
503                 }
504             } catch (SAXException e) {
505                 throw new TransletException(e);
506             }
507         }
508     }
509 
510     // %REVISIT% Can the makeNode() and makeNodeList() interfaces ever get used?
511     public Node makeNode(int index)
512     {
513         return null;
514     }
515 
516     public Node makeNode(DTMAxisIterator iter)
517     {
518         return null;
519     }
520 
521     public NodeList makeNodeList(int index)
522     {
523         return null;
524     }
525 
526     public NodeList makeNodeList(DTMAxisIterator iter)
527     {
528         return null;
529     }
530 
531     public String getLanguage(int node)
532     {
533         return null;
534     }
535 
536     public int getSize()
537     {
538         return 2;
539     }
540 
541     public String getDocumentURI(int node)
542     {
543         return "simple_rtf" + _documentURIIndex++;
544     }
545 
546     public void setFilter(StripFilter filter)
547     {
548     }
549 
550     public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces)
551     {
552     }
553 
554     public boolean isElement(final int node)
555     {
556         return false;
557     }
558 
559     public boolean isAttribute(final int node)
560     {
561         return false;
562     }
563 
564     public String lookupNamespace(int node, String prefix)
565         throws TransletException
566     {
567         return null;
568     }
569 
570     /**
571      * Return the node identity from a node handle.
572      */
573     public int getNodeIdent(final int nodehandle)
574     {
575         return (nodehandle != DTM.NULL) ? (nodehandle - _documentID) : DTM.NULL;
576     }
577 
578     /**
579      * Return the node handle from a node identity.
580      */
581     public int getNodeHandle(final int nodeId)
582     {
583         return (nodeId != DTM.NULL) ? (nodeId + _documentID) : DTM.NULL;
584     }
585 
586     public DOM getResultTreeFrag(int initialSize, int rtfType)
587     {
588         return null;
589     }
590 
591     public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToManager)
592     {
593         return null;
594     }
595 
596     public SerializationHandler getOutputDomBuilder()
597     {
598         return this;
599     }
600 
601     public int getNSType(int node)
602     {
603         return 0;
604     }
605 
606     public String getUnparsedEntityURI(String name)
607     {
608         return null;
609     }
610 
611     public Hashtable getElementsWithIDs()
612     {
613         return null;
614     }
615 
616     /** Implementation of the SerializationHandler interfaces **/
617 
618     /**
619      * We only need to override the endDocument, characters, and
620      * setEscaping interfaces. A simple RTF does not have element
621      * nodes. We do not need to touch startElement and endElement.
622      */
623 
624     public void startDocument() throws SAXException
625     {
626 
627     }
628 
629     public void endDocument() throws SAXException
630     {
631         // Set the String value when the document is built.
632         if (_size == 1)
633             _text = _textArray[0];
634         else {
635             StringBuffer buffer = new StringBuffer();
636             for (int i = 0; i < _size; i++) {
637                 buffer.append(_textArray[i]);
638             }
639             _text = buffer.toString();
640         }
641     }
642 
643     public void characters(String str) throws SAXException
644     {
645         // Resize the text array if necessary
646         if (_size >= _textArray.length) {
647             String[] newTextArray = new String[_textArray.length * 2];
648             System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length);
649             _textArray = newTextArray;
650         }
651 
652         // If the escape setting is false, set the corresponding bit in
653         // the _dontEscape BitArray.
654         if (!_escaping) {
655             // The _dontEscape array is only created when needed.
656             if (_dontEscape == null) {
657                 _dontEscape = new BitArray(8);
658             }
659 
660             // Resize the _dontEscape array if necessary
661             if (_size >= _dontEscape.size())
662                 _dontEscape.resize(_dontEscape.size() * 2);
663 
664             _dontEscape.setBit(_size);
665         }
666 
667         _textArray[_size++] = str;
668     }
669 
670     public void characters(char[] ch, int offset, int length)
671         throws SAXException
672     {
673         if (_size >= _textArray.length) {
674             String[] newTextArray = new String[_textArray.length * 2];
675             System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length);
676             _textArray = newTextArray;
677         }
678 
679         if (!_escaping) {
680             if (_dontEscape == null) {
681                 _dontEscape = new BitArray(8);
682             }
683 
684             if (_size >= _dontEscape.size())
685                 _dontEscape.resize(_dontEscape.size() * 2);
686 
687             _dontEscape.setBit(_size);
688         }
689 
690         _textArray[_size++] = new String(ch, offset, length);
691 
692     }
693 
694     public boolean setEscaping(boolean escape) throws SAXException
695     {
696         final boolean temp = _escaping;
697         _escaping = escape;
698         return temp;
699     }
700 
701     /** Implementation of the DTM interfaces **/
702 
703     /**
704      * The DTM interfaces are not used in this class. Implementing the DTM
705      * interface is a requirement from MultiDOM. If we have a better way
706      * of handling multiple documents, we can get rid of the DTM dependency.
707      *
708      * The following interfaces are just placeholders. The implementation
709      * does not have an impact because they will not be used.
710      */
711 
712     public void setFeature(String featureId, boolean state)
713     {
714     }
715 
716     public void setProperty(String property, Object value)
717     {
718     }
719 
720     public DTMAxisTraverser getAxisTraverser(final int axis)
721     {
722         return null;
723     }
724 
725     public boolean hasChildNodes(int nodeHandle)
726     {
727         return (getNodeIdent(nodeHandle) == RTF_ROOT);
728     }
729 
730     public int getFirstChild(int nodeHandle)
731     {
732         int nodeID = getNodeIdent(nodeHandle);
733         if (nodeID == RTF_ROOT)
734             return getNodeHandle(RTF_TEXT);
735         else
736             return DTM.NULL;
737     }
738 
739     public int getLastChild(int nodeHandle)
740     {
741         return getFirstChild(nodeHandle);
742     }
743 
744     public int getAttributeNode(int elementHandle, String namespaceURI, String name)
745     {
746         return DTM.NULL;
747     }
748 
749     public int getFirstAttribute(int nodeHandle)
750     {
751         return DTM.NULL;
752     }
753 
754     public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
755     {
756         return DTM.NULL;
757     }
758 
759     public int getNextSibling(int nodeHandle)
760     {
761         return DTM.NULL;
762     }
763 
764     public int getPreviousSibling(int nodeHandle)
765     {
766         return DTM.NULL;
767     }
768 
769     public int getNextAttribute(int nodeHandle)
770     {
771         return DTM.NULL;
772     }
773 
774     public int getNextNamespaceNode(int baseHandle, int namespaceHandle,
775                                   boolean inScope)
776     {
777         return DTM.NULL;
778     }
779 
780     public int getOwnerDocument(int nodeHandle)
781     {
782         return getDocument();
783     }
784 
785     public int getDocumentRoot(int nodeHandle)
786     {
787         return getDocument();
788     }
789 
790     public XMLString getStringValue(int nodeHandle)
791     {
792         return new XMLStringDefault(getStringValueX(nodeHandle));
793     }
794 
795     public int getStringValueChunkCount(int nodeHandle)
796     {
797         return 0;
798     }
799 
800     public char[] getStringValueChunk(int nodeHandle, int chunkIndex,
801                                     int[] startAndLen)
802     {
803         return null;
804     }
805 
806     public int getExpandedTypeID(String namespace, String localName, int type)
807     {
808         return DTM.NULL;
809     }
810 
811     public String getLocalNameFromExpandedNameID(int ExpandedNameID)
812     {
813         return EMPTY_STR;
814     }
815 
816     public String getNamespaceFromExpandedNameID(int ExpandedNameID)
817     {
818         return EMPTY_STR;
819     }
820 
821     public String getLocalName(int nodeHandle)
822     {
823         return EMPTY_STR;
824     }
825 
826     public String getPrefix(int nodeHandle)
827     {
828         return null;
829     }
830 
831     public String getNamespaceURI(int nodeHandle)
832     {
833         return EMPTY_STR;
834     }
835 
836     public String getNodeValue(int nodeHandle)
837     {
838         return (getNodeIdent(nodeHandle) == RTF_TEXT) ? _text : null;
839     }
840 
841     public short getNodeType(int nodeHandle)
842     {
843         int nodeID = getNodeIdent(nodeHandle);
844         if (nodeID == RTF_TEXT)
845             return DTM.TEXT_NODE;
846         else if (nodeID == RTF_ROOT)
847             return DTM.ROOT_NODE;
848         else
849             return DTM.NULL;
850 
851     }
852 
853     public short getLevel(int nodeHandle)
854     {
855         int nodeID = getNodeIdent(nodeHandle);
856         if (nodeID == RTF_TEXT)
857             return 2;
858         else if (nodeID == RTF_ROOT)
859             return 1;
860         else
861             return DTM.NULL;
862     }
863 
864     public boolean isSupported(String feature, String version)
865     {
866         return false;
867     }
868 
869     public String getDocumentBaseURI()
870     {
871         return EMPTY_STR;
872     }
873 
874     public void setDocumentBaseURI(String baseURI)
875     {
876     }
877 
878     public String getDocumentSystemIdentifier(int nodeHandle)
879     {
880         return null;
881     }
882 
883     public String getDocumentEncoding(int nodeHandle)
884     {
885         return null;
886     }
887 
888     public String getDocumentStandalone(int nodeHandle)
889     {
890         return null;
891     }
892 
893     public String getDocumentVersion(int documentHandle)
894     {
895         return null;
896     }
897 
898     public boolean getDocumentAllDeclarationsProcessed()
899     {
900         return false;
901     }
902 
903     public String getDocumentTypeDeclarationSystemIdentifier()
904     {
905         return null;
906     }
907 
908     public String getDocumentTypeDeclarationPublicIdentifier()
909     {
910         return null;
911     }
912 
913     public int getElementById(String elementId)
914     {
915         return DTM.NULL;
916     }
917 
918     public boolean supportsPreStripping()
919     {
920         return false;
921     }
922 
923     public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle)
924     {
925         return lessThan(firstNodeHandle, secondNodeHandle);
926     }
927 
928     public boolean isCharacterElementContentWhitespace(int nodeHandle)
929     {
930         return false;
931     }
932 
933     public boolean isDocumentAllDeclarationsProcessed(int documentHandle)
934     {
935         return false;
936     }
937 
938     public boolean isAttributeSpecified(int attributeHandle)
939     {
940         return false;
941     }
942 
943     public void dispatchCharactersEvents(
944         int nodeHandle,
945         org.xml.sax.ContentHandler ch,
946         boolean normalize)
947           throws org.xml.sax.SAXException
948     {
949     }
950 
951     public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch)
952       throws org.xml.sax.SAXException
953     {
954     }
955 
956     public org.w3c.dom.Node getNode(int nodeHandle)
957     {
958         return makeNode(nodeHandle);
959     }
960 
961     public boolean needsTwoThreads()
962     {
963         return false;
964     }
965 
966     public org.xml.sax.ContentHandler getContentHandler()
967     {
968         return null;
969     }
970 
971     public org.xml.sax.ext.LexicalHandler getLexicalHandler()
972     {
973         return null;
974     }
975 
976     public org.xml.sax.EntityResolver getEntityResolver()
977     {
978         return null;
979     }
980 
981     public org.xml.sax.DTDHandler getDTDHandler()
982     {
983         return null;
984     }
985 
986     public org.xml.sax.ErrorHandler getErrorHandler()
987     {
988         return null;
989     }
990 
991     public org.xml.sax.ext.DeclHandler getDeclHandler()
992     {
993         return null;
994     }
995 
996     public void appendChild(int newChild, boolean clone, boolean cloneDepth)
997     {
998     }
999 
1000     public void appendTextChild(String str)
1001     {
1002     }
1003 
1004     public SourceLocator getSourceLocatorFor(int node)
1005     {
1006         return null;
1007     }
1008 
1009     public void documentRegistration()
1010     {
1011     }
1012 
1013     public void documentRelease()
1014     {
1015     }
1016 
1017     public void migrateTo(DTMManager manager)
1018     {
1019     }
1020 }