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