KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: SimpleResultTreeImpl.java,v 1.7 2004/02/16 22:54:59 minchau Exp $
18  */

19 package org.apache.xalan.xsltc.dom;
20
21 import org.apache.xalan.xsltc.DOM;
22 import org.apache.xalan.xsltc.TransletException;
23 import org.apache.xalan.xsltc.StripFilter;
24 import org.apache.xalan.xsltc.runtime.Hashtable;
25
26 import org.apache.xml.dtm.DTM;
27 import org.apache.xml.dtm.DTMAxisIterator;
28 import org.apache.xml.dtm.DTMAxisTraverser;
29 import org.apache.xml.dtm.DTMManager;
30 import org.apache.xml.dtm.ref.DTMAxisIteratorBase;
31 import org.apache.xml.dtm.ref.DTMManagerDefault;
32 import org.apache.xml.serializer.EmptySerializer;
33 import org.apache.xml.serializer.SerializationHandler;
34 import org.apache.xml.utils.XMLString;
35 import org.apache.xml.utils.XMLStringDefault;
36
37 import org.w3c.dom.Node JavaDoc;
38 import org.w3c.dom.NodeList JavaDoc;
39
40 import org.xml.sax.SAXException JavaDoc;
41
42 import javax.xml.transform.SourceLocator JavaDoc;
43
44 /**
45  * This class represents a light-weight DOM model for simple result tree fragment(RTF).
46  * A simple RTF is an RTF that has only one Text node. The Text node can be produced by a
47  * combination of Text, xsl:value-of and xsl:number instructions. It can also be produced
48  * by a control structure (xsl:if or xsl:choose) whose body is pure Text.
49  * <p>
50  * A SimpleResultTreeImpl has only two nodes, i.e. the ROOT node and its Text child. All DOM
51  * interfaces are overridden with this in mind. For example, the getStringValue() interface
52  * returns the value of the Text node. This class receives the character data from the
53  * characters() interface.
54  * <p>
55  * This class implements DOM and SerializationHandler. It also implements the DTM interface
56  * for support in MultiDOM. The nested iterators (SimpleIterator and SingletonIterator) are
57  * used to support the nodeset() extension function.
58  */

59 public class SimpleResultTreeImpl extends EmptySerializer implements DOM, DTM
60 {
61     
62     /**
63      * The SimpleIterator is designed to support the nodeset() extension function. It has
64      * a traversal direction parameter. The DOWN direction is used for child and descendant
65      * axes, while the UP direction is used for parent and ancestor axes.
66      *
67      * This iterator only handles two nodes (RTF_ROOT and RTF_TEXT). If the type is set,
68      * it will also match the node type with the given type.
69      */

70     public final class SimpleIterator extends DTMAxisIteratorBase
71     {
72         static final int DIRECTION_UP = 0;
73         static final int DIRECTION_DOWN = 1;
74         static final int NO_TYPE = -1;
75         
76         // The direction of traversal (default to DOWN).
77
// DOWN is for child and descendant. UP is for parent and ancestor.
78
int _direction = DIRECTION_DOWN;
79         
80         int _type = NO_TYPE;
81         int _currentNode;
82         
83         public SimpleIterator()
84         {
85         }
86         
87         public SimpleIterator(int direction)
88         {
89             _direction = direction;
90         }
91         
92         public SimpleIterator(int direction, int type)
93         {
94              _direction = direction;
95              _type = type;
96         }
97         
98         public int next()
99         {
100             // Increase the node ID for down traversal. Also match the node type
101
// if the type is given.
102
if (_direction == DIRECTION_DOWN) {
103                 while (_currentNode < NUMBER_OF_NODES) {
104                     if (_type != NO_TYPE) {
105                         if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
106                             || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
107                             return returnNode(getNodeHandle(_currentNode++));
108                         else
109                             _currentNode++;
110                     }
111                     else
112                         return returnNode(getNodeHandle(_currentNode++));
113                 }
114                 
115                 return END;
116             }
117             // Decrease the node ID for up traversal.
118
else {
119                 while (_currentNode >= 0) {
120                     if (_type != NO_TYPE) {
121                         if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
122                             || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
123                             return returnNode(getNodeHandle(_currentNode--));
124                         else
125                             _currentNode--;
126                     }
127                     else
128                         return returnNode(getNodeHandle(_currentNode--));
129                 }
130                 
131                 return END;
132             }
133         }
134                 
135         public DTMAxisIterator setStartNode(int nodeHandle)
136         {
137             int nodeID = getNodeIdent(nodeHandle);
138             _startNode = nodeID;
139             
140             // Increase the node ID by 1 if self is not included.
141
if (!_includeSelf && nodeID != DTM.NULL) {
142                 if (_direction == DIRECTION_DOWN)
143                     nodeID++;
144                 else if (_direction == DIRECTION_UP)
145                     nodeID--;
146             }
147             
148             _currentNode = nodeID;
149             return this;
150         }
151                 
152         public void setMark()
153         {
154             _markedNode = _currentNode;
155         }
156         
157         public void gotoMark()
158         {
159             _currentNode = _markedNode;
160         }
161         
162     } // END of SimpleIterator
163

164     /**
165      * The SingletonIterator is used for the self axis.
166      */

167     public final class SingletonIterator extends DTMAxisIteratorBase
168     {
169         static final int NO_TYPE = -1;
170         int _type = NO_TYPE;
171         int _currentNode;
172         
173         public SingletonIterator()
174         {
175         }
176         
177         public SingletonIterator(int type)
178         {
179             _type = type;
180         }
181         
182         public void setMark()
183         {
184             _markedNode = _currentNode;
185         }
186         
187         public void gotoMark()
188         {
189             _currentNode = _markedNode;
190         }
191
192         public DTMAxisIterator setStartNode(int nodeHandle)
193         {
194             _currentNode = _startNode = getNodeIdent(nodeHandle);
195             return this;
196         }
197         
198         public int next()
199         {
200             if (_currentNode == END)
201                 return END;
202             
203             _currentNode = END;
204             
205             if (_type != NO_TYPE) {
206                 if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
207                     || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
208                     return getNodeHandle(_currentNode);
209             }
210             else
211                 return getNodeHandle(_currentNode);
212             
213             return END;
214         }
215         
216     } // END of SingletonIterator
217

218     // empty iterator to be returned when there are no children
219
private final static DTMAxisIterator EMPTY_ITERATOR =
220         new DTMAxisIteratorBase() {
221             public DTMAxisIterator reset() { return this; }
222             public DTMAxisIterator setStartNode(int node) { return this; }
223             public int next() { return DTM.NULL; }
224             public void setMark() {}
225             public void gotoMark() {}
226             public int getLast() { return 0; }
227             public int getPosition() { return 0; }
228             public DTMAxisIterator cloneIterator() { return this; }
229             public void setRestartable(boolean isRestartable) { }
230         };
231     
232     
233     // The root node id of the simple RTF
234
public static final int RTF_ROOT = 0;
235     
236     // The Text node id of the simple RTF (simple RTF has only one Text node).
237
public static final int RTF_TEXT = 1;
238     
239     // The number of nodes.
240
public static final int NUMBER_OF_NODES = 2;
241     
242     // Document URI index, which increases by 1 at each getDocumentURI() call.
243
private static int _documentURIIndex = 0;
244     
245     // Constant for empty String
246
private static final String JavaDoc EMPTY_STR = "";
247     
248     // The String value of the Text node.
249
// This is set at the endDocument() call.
250
private String JavaDoc _text;
251     
252     // The array of Text items, which is built by the characters() call.
253
// The characters() interface can be called multiple times. Each character item
254
// can have different escape settings.
255
protected String JavaDoc[] _textArray;
256     
257     // The DTMManager
258
protected XSLTCDTMManager _dtmManager;
259     
260     // Number of character items
261
protected int _size = 0;
262     
263     // The document ID
264
private int _documentID;
265
266     // A BitArray, each bit holding the escape setting for a character item.
267
private BitArray _dontEscape = null;
268     
269     // The current escape setting
270
private boolean _escaping = true;
271     
272     // Create a SimpleResultTreeImpl from a DTMManager and a document ID.
273
public SimpleResultTreeImpl(XSLTCDTMManager dtmManager, int documentID)
274     {
275         _dtmManager = dtmManager;
276         _documentID = documentID;
277         _textArray = new String JavaDoc[4];
278     }
279     
280     public DTMManagerDefault getDTMManager()
281     {
282         return _dtmManager;
283     }
284     
285     // Return the document ID
286
public int getDocument()
287     {
288         return _documentID;
289     }
290
291     // Return the String value of the RTF
292
public String JavaDoc getStringValue()
293     {
294         return _text;
295     }
296     
297     public DTMAxisIterator getIterator()
298     {
299         return new SingletonIterator(getDocument());
300     }
301     
302     public DTMAxisIterator getChildren(final int node)
303     {
304         return new SimpleIterator().setStartNode(node);
305     }
306     
307     public DTMAxisIterator getTypedChildren(final int type)
308     {
309         return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type);
310     }
311     
312     // Return the axis iterator for a given axis.
313
// The SimpleIterator is used for the child, descendant, parent and ancestor axes.
314
public DTMAxisIterator getAxisIterator(final int axis)
315     {
316         switch (axis)
317         {
318             case Axis.CHILD:
319             case Axis.DESCENDANT:
320                 return new SimpleIterator(SimpleIterator.DIRECTION_DOWN);
321             case Axis.PARENT:
322             case Axis.ANCESTOR:
323                 return new SimpleIterator(SimpleIterator.DIRECTION_UP);
324             case Axis.ANCESTORORSELF:
325                 return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf();
326             case Axis.DESCENDANTORSELF:
327                 return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf();
328             case Axis.SELF:
329                 return new SingletonIterator();
330             default:
331                 return EMPTY_ITERATOR;
332         }
333     }
334     
335     public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
336     {
337         switch (axis)
338         {
339             case Axis.CHILD:
340             case Axis.DESCENDANT:
341                 return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type);
342             case Axis.PARENT:
343             case Axis.ANCESTOR:
344                 return new SimpleIterator(SimpleIterator.DIRECTION_UP, type);
345             case Axis.ANCESTORORSELF:
346                 return (new SimpleIterator(SimpleIterator.DIRECTION_UP, type)).includeSelf();
347             case Axis.DESCENDANTORSELF:
348                 return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type)).includeSelf();
349             case Axis.SELF:
350                 return new SingletonIterator(type);
351             default:
352                 return EMPTY_ITERATOR;
353         }
354     }
355     
356     // %REVISIT% Can this one ever get used?
357
public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself)
358     {
359         return null;
360     }
361     
362     public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns)
363     {
364         return null;
365     }
366     
367     // %REVISIT% Can this one ever get used?
368
public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
369                          String JavaDoc value, boolean op)
370     {
371         return null;
372     }
373     
374     public DTMAxisIterator orderNodes(DTMAxisIterator source, int node)
375     {
376         return source;
377     }
378     
379     public String JavaDoc getNodeName(final int node)
380     {
381         if (getNodeIdent(node) == RTF_TEXT)
382             return "#text";
383         else
384             return EMPTY_STR;
385     }
386     
387     public String JavaDoc getNodeNameX(final int node)
388     {
389         return EMPTY_STR;
390     }
391     
392     public String JavaDoc getNamespaceName(final int node)
393     {
394         return EMPTY_STR;
395     }
396     
397     // Return the expanded type id of a given node
398
public int getExpandedTypeID(final int nodeHandle)
399     {
400         int nodeID = getNodeIdent(nodeHandle);
401         if (nodeID == RTF_TEXT)
402             return DTM.TEXT_NODE;
403         else if (nodeID == RTF_ROOT)
404             return DTM.ROOT_NODE;
405         else
406             return DTM.NULL;
407     }
408     
409     public int getNamespaceType(final int node)
410     {
411         return 0;
412     }
413     
414     public int getParent(final int nodeHandle)
415     {
416         int nodeID = getNodeIdent(nodeHandle);
417         return (nodeID == RTF_TEXT) ? getNodeHandle(RTF_ROOT) : DTM.NULL;
418     }
419     
420     public int getAttributeNode(final int gType, final int element)
421     {
422         return DTM.NULL;
423     }
424     
425     public String JavaDoc getStringValueX(final int nodeHandle)
426     {
427         int nodeID = getNodeIdent(nodeHandle);
428         if (nodeID == RTF_ROOT || nodeID == RTF_TEXT)
429             return _text;
430         else
431             return EMPTY_STR;
432     }
433     
434     public void copy(final int node, SerializationHandler handler)
435     throws TransletException
436     {
437         characters(node, handler);
438     }
439     
440     public void copy(DTMAxisIterator nodes, SerializationHandler handler)
441     throws TransletException
442     {
443         int node;
444         while ((node = nodes.next()) != DTM.NULL)
445         {
446             copy(node, handler);
447         }
448     }
449     
450     public String JavaDoc shallowCopy(final int node, SerializationHandler handler)
451     throws TransletException
452     {
453         characters(node, handler);
454         return null;
455     }
456     
457     public boolean lessThan(final int node1, final int node2)
458     {
459         if (node1 == DTM.NULL) {
460             return false;
461         }
462         else if (node2 == DTM.NULL) {
463             return true;
464         }
465         else
466             return (node1 < node2);
467     }
468     
469     /**
470      * Dispatch the character content of a node to an output handler.
471      *
472      * The escape setting should be taken care of when outputting to
473      * a handler.
474      */

475     public void characters(final int node, SerializationHandler handler)
476         throws TransletException
477     {
478         int nodeID = getNodeIdent(node);
479         if (nodeID == RTF_ROOT || nodeID == RTF_TEXT) {
480             boolean escapeBit = false;
481             boolean oldEscapeSetting = false;
482
483             try {
484                 for (int i = 0; i < _size; i++) {
485
486                     if (_dontEscape != null) {
487                         escapeBit = _dontEscape.getBit(i);
488                         if (escapeBit) {
489                             oldEscapeSetting = handler.setEscaping(false);
490                         }
491                     }
492                 
493                     handler.characters(_textArray[i]);
494                 
495                     if (escapeBit) {
496                         handler.setEscaping(oldEscapeSetting);
497                     }
498                 }
499             } catch (SAXException JavaDoc e) {
500                 throw new TransletException(e);
501             }
502         }
503     }
504     
505     // %REVISIT% Can the makeNode() and makeNodeList() interfaces ever get used?
506
public Node JavaDoc makeNode(int index)
507     {
508         return null;
509     }
510     
511     public Node JavaDoc makeNode(DTMAxisIterator iter)
512     {
513         return null;
514     }
515     
516     public NodeList JavaDoc makeNodeList(int index)
517     {
518         return null;
519     }
520     
521     public NodeList JavaDoc makeNodeList(DTMAxisIterator iter)
522     {
523         return null;
524     }
525     
526     public String JavaDoc getLanguage(int node)
527     {
528         return null;
529     }
530     
531     public int getSize()
532     {
533         return 2;
534     }
535     
536     public String JavaDoc getDocumentURI(int node)
537     {
538         return "simple_rtf" + _documentURIIndex++;
539     }
540     
541     public void setFilter(StripFilter filter)
542     {
543     }
544     
545     public void setupMapping(String JavaDoc[] names, String JavaDoc[] uris, int[] types, String JavaDoc[] namespaces)
546     {
547     }
548     
549     public boolean isElement(final int node)
550     {
551         return false;
552     }
553     
554     public boolean isAttribute(final int node)
555     {
556         return false;
557     }
558     
559     public String JavaDoc lookupNamespace(int node, String JavaDoc prefix)
560     throws TransletException
561     {
562         return null;
563     }
564     
565     /**
566      * Return the node identity from a node handle.
567      */

568     public int getNodeIdent(final int nodehandle)
569     {
570         return (nodehandle != DTM.NULL) ? (nodehandle - _documentID) : DTM.NULL;
571     }
572     
573     /**
574      * Return the node handle from a node identity.
575      */

576     public int getNodeHandle(final int nodeId)
577     {
578         return (nodeId != DTM.NULL) ? (nodeId + _documentID) : DTM.NULL;
579     }
580     
581     public DOM getResultTreeFrag(int initialSize, int rtfType)
582     {
583         return null;
584     }
585     
586     public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToManager)
587     {
588         return null;
589     }
590     
591     public SerializationHandler getOutputDomBuilder()
592     {
593         return this;
594     }
595     
596     public int getNSType(int node)
597     {
598         return 0;
599     }
600     
601     public String JavaDoc getUnparsedEntityURI(String JavaDoc name)
602     {
603         return null;
604     }
605     
606     public Hashtable getElementsWithIDs()
607     {
608         return null;
609     }
610
611     /** Implementation of the SerializationHandler interfaces **/
612     
613     /**
614      * We only need to override the endDocument, characters, and
615      * setEscaping interfaces. A simple RTF does not have element
616      * nodes. We do not need to touch startElement and endElement.
617      */

618     
619     public void startDocument() throws SAXException JavaDoc
620     {
621     
622     }
623     
624     public void endDocument() throws SAXException JavaDoc
625     {
626         // Set the String value when the document is built.
627
if (_size == 1)
628             _text = _textArray[0];
629         else {
630             StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
631             for (int i = 0; i < _size; i++) {
632                 buffer.append(_textArray[i]);
633             }
634             _text = buffer.toString();
635         }
636     }
637
638     public void characters(String JavaDoc str) throws SAXException JavaDoc
639     {
640         // Resize the text array if necessary
641
if (_size >= _textArray.length) {
642             String JavaDoc[] newTextArray = new String JavaDoc[_textArray.length * 2];
643             System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length);
644             _textArray = newTextArray;
645         }
646         
647         // If the escape setting is false, set the corresponding bit in
648
// the _dontEscape BitArray.
649
if (!_escaping) {
650             // The _dontEscape array is only created when needed.
651
if (_dontEscape == null) {
652                 _dontEscape = new BitArray(8);
653             }
654             
655             // Resize the _dontEscape array if necessary
656
if (_size >= _dontEscape.size())
657                 _dontEscape.resize(_dontEscape.size() * 2);
658             
659             _dontEscape.setBit(_size);
660         }
661         
662         _textArray[_size++] = str;
663     }
664     
665     public void characters(char[] ch, int offset, int length)
666     throws SAXException JavaDoc
667     {
668         if (_size >= _textArray.length) {
669             String JavaDoc[] newTextArray = new String JavaDoc[_textArray.length * 2];
670             System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length);
671             _textArray = newTextArray;
672         }
673
674         if (!_escaping) {
675             if (_dontEscape == null) {
676                 _dontEscape = new BitArray(8);
677             }
678             
679             if (_size >= _dontEscape.size())
680                 _dontEscape.resize(_dontEscape.size() * 2);
681             
682             _dontEscape.setBit(_size);
683         }
684        
685         _textArray[_size++] = new String JavaDoc(ch, offset, length);
686         
687     }
688     
689     public boolean setEscaping(boolean escape) throws SAXException JavaDoc
690     {
691         final boolean temp = _escaping;
692         _escaping = escape;
693         return temp;
694     }
695         
696     /** Implementation of the DTM interfaces **/
697     
698     /**
699      * The DTM interfaces are not used in this class. Implementing the DTM
700      * interface is a requirement from MultiDOM. If we have a better way
701      * of handling multiple documents, we can get rid of the DTM dependency.
702      *
703      * The following interfaces are just placeholders. The implementation
704      * does not have an impact because they will not be used.
705      */

706      
707     public void setFeature(String JavaDoc featureId, boolean state)
708     {
709     }
710     
711     public void setProperty(String JavaDoc property, Object JavaDoc value)
712     {
713     }
714     
715     public DTMAxisTraverser getAxisTraverser(final int axis)
716     {
717         return null;
718     }
719     
720     public boolean hasChildNodes(int nodeHandle)
721     {
722         return (getNodeIdent(nodeHandle) == RTF_ROOT);
723     }
724     
725     public int getFirstChild(int nodeHandle)
726     {
727         int nodeID = getNodeIdent(nodeHandle);
728         if (nodeID == RTF_ROOT)
729             return getNodeHandle(RTF_TEXT);
730         else
731             return DTM.NULL;
732     }
733     
734     public int getLastChild(int nodeHandle)
735     {
736         return getFirstChild(nodeHandle);
737     }
738     
739     public int getAttributeNode(int elementHandle, String JavaDoc namespaceURI, String JavaDoc name)
740     {
741         return DTM.NULL;
742     }
743     
744     public int getFirstAttribute(int nodeHandle)
745     {
746         return DTM.NULL;
747     }
748     
749     public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
750     {
751         return DTM.NULL;
752     }
753     
754     public int getNextSibling(int nodeHandle)
755     {
756         return DTM.NULL;
757     }
758     
759     public int getPreviousSibling(int nodeHandle)
760     {
761         return DTM.NULL;
762     }
763     
764     public int getNextAttribute(int nodeHandle)
765     {
766         return DTM.NULL;
767     }
768     
769     public int getNextNamespaceNode(int baseHandle, int namespaceHandle,
770                                   boolean inScope)
771     {
772         return DTM.NULL;
773     }
774     
775     public int getOwnerDocument(int nodeHandle)
776     {
777         return getDocument();
778     }
779     
780     public int getDocumentRoot(int nodeHandle)
781     {
782         return getDocument();
783     }
784     
785     public XMLString getStringValue(int nodeHandle)
786     {
787         return new XMLStringDefault(getStringValueX(nodeHandle));
788     }
789     
790     public int getStringValueChunkCount(int nodeHandle)
791     {
792         return 0;
793     }
794     
795     public char[] getStringValueChunk(int nodeHandle, int chunkIndex,
796                                     int[] startAndLen)
797     {
798         return null;
799     }
800     
801     public int getExpandedTypeID(String JavaDoc namespace, String JavaDoc localName, int type)
802     {
803         return DTM.NULL;
804     }
805     
806     public String JavaDoc getLocalNameFromExpandedNameID(int ExpandedNameID)
807     {
808         return EMPTY_STR;
809     }
810     
811     public String JavaDoc getNamespaceFromExpandedNameID(int ExpandedNameID)
812     {
813         return EMPTY_STR;
814     }
815     
816     public String JavaDoc getLocalName(int nodeHandle)
817     {
818         return EMPTY_STR;
819     }
820     
821     public String JavaDoc getPrefix(int nodeHandle)
822     {
823         return null;
824     }
825     
826     public String JavaDoc getNamespaceURI(int nodeHandle)
827     {
828         return EMPTY_STR;
829     }
830     
831     public String JavaDoc getNodeValue(int nodeHandle)
832     {
833         return (getNodeIdent(nodeHandle) == RTF_TEXT) ? _text : null;
834     }
835     
836     public short getNodeType(int nodeHandle)
837     {
838         int nodeID = getNodeIdent(nodeHandle);
839         if (nodeID == RTF_TEXT)
840             return DTM.TEXT_NODE;
841         else if (nodeID == RTF_ROOT)
842             return DTM.ROOT_NODE;
843         else
844             return DTM.NULL;
845         
846     }
847     
848     public short getLevel(int nodeHandle)
849     {
850         int nodeID = getNodeIdent(nodeHandle);
851         if (nodeID == RTF_TEXT)
852             return 2;
853         else if (nodeID == RTF_ROOT)
854             return 1;
855         else
856             return DTM.NULL;
857     }
858     
859     public boolean isSupported(String JavaDoc feature, String JavaDoc version)
860     {
861         return false;
862     }
863     
864     public String JavaDoc getDocumentBaseURI()
865     {
866         return EMPTY_STR;
867     }
868     
869     public void setDocumentBaseURI(String JavaDoc baseURI)
870     {
871     }
872     
873     public String JavaDoc getDocumentSystemIdentifier(int nodeHandle)
874     {
875         return null;
876     }
877     
878     public String JavaDoc getDocumentEncoding(int nodeHandle)
879     {
880         return null;
881     }
882     
883     public String JavaDoc getDocumentStandalone(int nodeHandle)
884     {
885         return null;
886     }
887     
888     public String JavaDoc getDocumentVersion(int documentHandle)
889     {
890         return null;
891     }
892     
893     public boolean getDocumentAllDeclarationsProcessed()
894     {
895         return false;
896     }
897     
898     public String JavaDoc getDocumentTypeDeclarationSystemIdentifier()
899     {
900         return null;
901     }
902     
903     public String JavaDoc getDocumentTypeDeclarationPublicIdentifier()
904     {
905         return null;
906     }
907     
908     public int getElementById(String JavaDoc elementId)
909     {
910         return DTM.NULL;
911     }
912         
913     public boolean supportsPreStripping()
914     {
915         return false;
916     }
917     
918     public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle)
919     {
920         return lessThan(firstNodeHandle, secondNodeHandle);
921     }
922     
923     public boolean isCharacterElementContentWhitespace(int nodeHandle)
924     {
925         return false;
926     }
927     
928     public boolean isDocumentAllDeclarationsProcessed(int documentHandle)
929     {
930         return false;
931     }
932     
933     public boolean isAttributeSpecified(int attributeHandle)
934     {
935         return false;
936     }
937     
938     public void dispatchCharactersEvents(
939         int nodeHandle,
940         org.xml.sax.ContentHandler JavaDoc ch,
941         boolean normalize)
942           throws org.xml.sax.SAXException JavaDoc
943     {
944     }
945     
946     public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler JavaDoc ch)
947       throws org.xml.sax.SAXException JavaDoc
948     {
949     }
950     
951     public org.w3c.dom.Node JavaDoc getNode(int nodeHandle)
952     {
953         return makeNode(nodeHandle);
954     }
955     
956     public boolean needsTwoThreads()
957     {
958         return false;
959     }
960     
961     public org.xml.sax.ContentHandler JavaDoc getContentHandler()
962     {
963         return null;
964     }
965     
966     public org.xml.sax.ext.LexicalHandler JavaDoc getLexicalHandler()
967     {
968         return null;
969     }
970     
971     public org.xml.sax.EntityResolver JavaDoc getEntityResolver()
972     {
973         return null;
974     }
975     
976     public org.xml.sax.DTDHandler JavaDoc getDTDHandler()
977     {
978         return null;
979     }
980     
981     public org.xml.sax.ErrorHandler JavaDoc getErrorHandler()
982     {
983         return null;
984     }
985     
986     public org.xml.sax.ext.DeclHandler JavaDoc getDeclHandler()
987     {
988         return null;
989     }
990     
991     public void appendChild(int newChild, boolean clone, boolean cloneDepth)
992     {
993     }
994     
995     public void appendTextChild(String JavaDoc str)
996     {
997     }
998     
999     public SourceLocator JavaDoc getSourceLocatorFor(int node)
1000    {
1001        return null;
1002    }
1003    
1004    public void documentRegistration()
1005    {
1006    }
1007    
1008    public void documentRelease()
1009    {
1010    }
1011
1012    public void migrateTo(DTMManager manager)
1013    {
1014    }
1015}
1016
Popular Tags