286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 1999-2004 The Apache Software Foundation.
286N/A *
286N/A * Licensed under the Apache License, Version 2.0 (the "License");
286N/A * you may not use this file except in compliance with the License.
286N/A * You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A/*
286N/A * $Id: SimpleResultTreeImpl.java,v 1.2.4.1 2005/09/06 10:09:25 pvedula Exp $
286N/A */
286N/Apackage com.sun.org.apache.xalan.internal.xsltc.dom;
286N/A
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.DOM;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.TransletException;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.StripFilter;
286N/Aimport com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
286N/A
286N/Aimport com.sun.org.apache.xml.internal.dtm.DTM;
286N/Aimport com.sun.org.apache.xml.internal.dtm.Axis;
286N/Aimport com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
286N/Aimport com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser;
286N/Aimport com.sun.org.apache.xml.internal.dtm.DTMManager;
286N/Aimport com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase;
286N/Aimport com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault;
286N/Aimport com.sun.org.apache.xml.internal.serializer.EmptySerializer;
286N/Aimport com.sun.org.apache.xml.internal.serializer.SerializationHandler;
286N/Aimport com.sun.org.apache.xml.internal.utils.XMLString;
286N/Aimport com.sun.org.apache.xml.internal.utils.XMLStringDefault;
286N/A
286N/Aimport org.w3c.dom.Node;
286N/Aimport org.w3c.dom.NodeList;
286N/A
286N/Aimport org.xml.sax.SAXException;
286N/A
286N/Aimport javax.xml.transform.SourceLocator;
286N/A
286N/A/**
286N/A * This class represents a light-weight DOM model for simple result tree fragment(RTF).
286N/A * A simple RTF is an RTF that has only one Text node. The Text node can be produced by a
286N/A * combination of Text, xsl:value-of and xsl:number instructions. It can also be produced
286N/A * by a control structure (xsl:if or xsl:choose) whose body is pure Text.
286N/A * <p>
286N/A * A SimpleResultTreeImpl has only two nodes, i.e. the ROOT node and its Text child. All DOM
286N/A * interfaces are overridden with this in mind. For example, the getStringValue() interface
286N/A * returns the value of the Text node. This class receives the character data from the
286N/A * characters() interface.
286N/A * <p>
286N/A * This class implements DOM and SerializationHandler. It also implements the DTM interface
286N/A * for support in MultiDOM. The nested iterators (SimpleIterator and SingletonIterator) are
286N/A * used to support the nodeset() extension function.
286N/A */
286N/Apublic class SimpleResultTreeImpl extends EmptySerializer implements DOM, DTM
286N/A{
286N/A
286N/A /**
286N/A * The SimpleIterator is designed to support the nodeset() extension function. It has
286N/A * a traversal direction parameter. The DOWN direction is used for child and descendant
286N/A * axes, while the UP direction is used for parent and ancestor axes.
286N/A *
286N/A * This iterator only handles two nodes (RTF_ROOT and RTF_TEXT). If the type is set,
286N/A * it will also match the node type with the given type.
286N/A */
286N/A public final class SimpleIterator extends DTMAxisIteratorBase
286N/A {
286N/A static final int DIRECTION_UP = 0;
286N/A static final int DIRECTION_DOWN = 1;
286N/A static final int NO_TYPE = -1;
286N/A
286N/A // The direction of traversal (default to DOWN).
286N/A // DOWN is for child and descendant. UP is for parent and ancestor.
286N/A int _direction = DIRECTION_DOWN;
286N/A
286N/A int _type = NO_TYPE;
286N/A int _currentNode;
286N/A
286N/A public SimpleIterator()
286N/A {
286N/A }
286N/A
286N/A public SimpleIterator(int direction)
286N/A {
286N/A _direction = direction;
286N/A }
286N/A
286N/A public SimpleIterator(int direction, int type)
286N/A {
286N/A _direction = direction;
286N/A _type = type;
286N/A }
286N/A
286N/A public int next()
286N/A {
286N/A // Increase the node ID for down traversal. Also match the node type
286N/A // if the type is given.
286N/A if (_direction == DIRECTION_DOWN) {
286N/A while (_currentNode < NUMBER_OF_NODES) {
286N/A if (_type != NO_TYPE) {
286N/A if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
286N/A || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
286N/A return returnNode(getNodeHandle(_currentNode++));
286N/A else
286N/A _currentNode++;
286N/A }
286N/A else
286N/A return returnNode(getNodeHandle(_currentNode++));
286N/A }
286N/A
286N/A return END;
286N/A }
286N/A // Decrease the node ID for up traversal.
286N/A else {
286N/A while (_currentNode >= 0) {
286N/A if (_type != NO_TYPE) {
286N/A if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
286N/A || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
286N/A return returnNode(getNodeHandle(_currentNode--));
286N/A else
286N/A _currentNode--;
286N/A }
286N/A else
286N/A return returnNode(getNodeHandle(_currentNode--));
286N/A }
286N/A
286N/A return END;
286N/A }
286N/A }
286N/A
286N/A public DTMAxisIterator setStartNode(int nodeHandle)
286N/A {
286N/A int nodeID = getNodeIdent(nodeHandle);
286N/A _startNode = nodeID;
286N/A
286N/A // Increase the node ID by 1 if self is not included.
286N/A if (!_includeSelf && nodeID != DTM.NULL) {
286N/A if (_direction == DIRECTION_DOWN)
286N/A nodeID++;
286N/A else if (_direction == DIRECTION_UP)
286N/A nodeID--;
286N/A }
286N/A
286N/A _currentNode = nodeID;
286N/A return this;
286N/A }
286N/A
286N/A public void setMark()
286N/A {
286N/A _markedNode = _currentNode;
286N/A }
286N/A
286N/A public void gotoMark()
286N/A {
286N/A _currentNode = _markedNode;
286N/A }
286N/A
286N/A } // END of SimpleIterator
286N/A
286N/A /**
286N/A * The SingletonIterator is used for the self axis.
286N/A */
286N/A public final class SingletonIterator extends DTMAxisIteratorBase
286N/A {
286N/A static final int NO_TYPE = -1;
286N/A int _type = NO_TYPE;
286N/A int _currentNode;
286N/A
286N/A public SingletonIterator()
286N/A {
286N/A }
286N/A
286N/A public SingletonIterator(int type)
286N/A {
286N/A _type = type;
286N/A }
286N/A
286N/A public void setMark()
286N/A {
286N/A _markedNode = _currentNode;
286N/A }
286N/A
286N/A public void gotoMark()
286N/A {
286N/A _currentNode = _markedNode;
286N/A }
286N/A
286N/A public DTMAxisIterator setStartNode(int nodeHandle)
286N/A {
286N/A _currentNode = _startNode = getNodeIdent(nodeHandle);
286N/A return this;
286N/A }
286N/A
286N/A public int next()
286N/A {
286N/A if (_currentNode == END)
286N/A return END;
286N/A
286N/A _currentNode = END;
286N/A
286N/A if (_type != NO_TYPE) {
286N/A if ((_currentNode == RTF_ROOT && _type == DTM.ROOT_NODE)
286N/A || (_currentNode == RTF_TEXT && _type == DTM.TEXT_NODE))
286N/A return getNodeHandle(_currentNode);
286N/A }
286N/A else
286N/A return getNodeHandle(_currentNode);
286N/A
286N/A return END;
286N/A }
286N/A
286N/A } // END of SingletonIterator
286N/A
286N/A // empty iterator to be returned when there are no children
286N/A private final static DTMAxisIterator EMPTY_ITERATOR =
286N/A new DTMAxisIteratorBase() {
286N/A public DTMAxisIterator reset() { return this; }
286N/A public DTMAxisIterator setStartNode(int node) { return this; }
286N/A public int next() { return DTM.NULL; }
286N/A public void setMark() {}
286N/A public void gotoMark() {}
286N/A public int getLast() { return 0; }
286N/A public int getPosition() { return 0; }
286N/A public DTMAxisIterator cloneIterator() { return this; }
286N/A public void setRestartable(boolean isRestartable) { }
286N/A };
286N/A
286N/A
286N/A // The root node id of the simple RTF
286N/A public static final int RTF_ROOT = 0;
286N/A
286N/A // The Text node id of the simple RTF (simple RTF has only one Text node).
286N/A public static final int RTF_TEXT = 1;
286N/A
286N/A // The number of nodes.
286N/A public static final int NUMBER_OF_NODES = 2;
286N/A
286N/A // Document URI index, which increases by 1 at each getDocumentURI() call.
286N/A private static int _documentURIIndex = 0;
286N/A
286N/A // Constant for empty String
286N/A private static final String EMPTY_STR = "";
286N/A
286N/A // The String value of the Text node.
286N/A // This is set at the endDocument() call.
286N/A private String _text;
286N/A
286N/A // The array of Text items, which is built by the characters() call.
286N/A // The characters() interface can be called multiple times. Each character item
286N/A // can have different escape settings.
286N/A protected String[] _textArray;
286N/A
286N/A // The DTMManager
286N/A protected XSLTCDTMManager _dtmManager;
286N/A
286N/A // Number of character items
286N/A protected int _size = 0;
286N/A
286N/A // The document ID
286N/A private int _documentID;
286N/A
286N/A // A BitArray, each bit holding the escape setting for a character item.
286N/A private BitArray _dontEscape = null;
286N/A
286N/A // The current escape setting
286N/A private boolean _escaping = true;
286N/A
286N/A // Create a SimpleResultTreeImpl from a DTMManager and a document ID.
286N/A public SimpleResultTreeImpl(XSLTCDTMManager dtmManager, int documentID)
286N/A {
286N/A _dtmManager = dtmManager;
286N/A _documentID = documentID;
286N/A _textArray = new String[4];
286N/A }
286N/A
286N/A public DTMManagerDefault getDTMManager()
286N/A {
286N/A return _dtmManager;
286N/A }
286N/A
286N/A // Return the document ID
286N/A public int getDocument()
286N/A {
286N/A return _documentID;
286N/A }
286N/A
286N/A // Return the String value of the RTF
286N/A public String getStringValue()
286N/A {
286N/A return _text;
286N/A }
286N/A
286N/A public DTMAxisIterator getIterator()
286N/A {
286N/A return new SingletonIterator(getDocument());
286N/A }
286N/A
286N/A public DTMAxisIterator getChildren(final int node)
286N/A {
286N/A return new SimpleIterator().setStartNode(node);
286N/A }
286N/A
286N/A public DTMAxisIterator getTypedChildren(final int type)
286N/A {
286N/A return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type);
286N/A }
286N/A
286N/A // Return the axis iterator for a given axis.
286N/A // The SimpleIterator is used for the child, descendant, parent and ancestor axes.
286N/A public DTMAxisIterator getAxisIterator(final int axis)
286N/A {
286N/A switch (axis)
286N/A {
286N/A case Axis.CHILD:
286N/A case Axis.DESCENDANT:
286N/A return new SimpleIterator(SimpleIterator.DIRECTION_DOWN);
286N/A case Axis.PARENT:
286N/A case Axis.ANCESTOR:
286N/A return new SimpleIterator(SimpleIterator.DIRECTION_UP);
286N/A case Axis.ANCESTORORSELF:
286N/A return (new SimpleIterator(SimpleIterator.DIRECTION_UP)).includeSelf();
286N/A case Axis.DESCENDANTORSELF:
286N/A return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN)).includeSelf();
286N/A case Axis.SELF:
286N/A return new SingletonIterator();
286N/A default:
286N/A return EMPTY_ITERATOR;
286N/A }
286N/A }
286N/A
286N/A public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
286N/A {
286N/A switch (axis)
286N/A {
286N/A case Axis.CHILD:
286N/A case Axis.DESCENDANT:
286N/A return new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type);
286N/A case Axis.PARENT:
286N/A case Axis.ANCESTOR:
286N/A return new SimpleIterator(SimpleIterator.DIRECTION_UP, type);
286N/A case Axis.ANCESTORORSELF:
286N/A return (new SimpleIterator(SimpleIterator.DIRECTION_UP, type)).includeSelf();
286N/A case Axis.DESCENDANTORSELF:
286N/A return (new SimpleIterator(SimpleIterator.DIRECTION_DOWN, type)).includeSelf();
286N/A case Axis.SELF:
286N/A return new SingletonIterator(type);
286N/A default:
286N/A return EMPTY_ITERATOR;
286N/A }
286N/A }
286N/A
286N/A // %REVISIT% Can this one ever get used?
286N/A public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A // %REVISIT% Can this one ever get used?
286N/A public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
286N/A String value, boolean op)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public DTMAxisIterator orderNodes(DTMAxisIterator source, int node)
286N/A {
286N/A return source;
286N/A }
286N/A
286N/A public String getNodeName(final int node)
286N/A {
286N/A if (getNodeIdent(node) == RTF_TEXT)
286N/A return "#text";
286N/A else
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public String getNodeNameX(final int node)
286N/A {
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public String getNamespaceName(final int node)
286N/A {
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A // Return the expanded type id of a given node
286N/A public int getExpandedTypeID(final int nodeHandle)
286N/A {
286N/A int nodeID = getNodeIdent(nodeHandle);
286N/A if (nodeID == RTF_TEXT)
286N/A return DTM.TEXT_NODE;
286N/A else if (nodeID == RTF_ROOT)
286N/A return DTM.ROOT_NODE;
286N/A else
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getNamespaceType(final int node)
286N/A {
286N/A return 0;
286N/A }
286N/A
286N/A public int getParent(final int nodeHandle)
286N/A {
286N/A int nodeID = getNodeIdent(nodeHandle);
286N/A return (nodeID == RTF_TEXT) ? getNodeHandle(RTF_ROOT) : DTM.NULL;
286N/A }
286N/A
286N/A public int getAttributeNode(final int gType, final int element)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public String getStringValueX(final int nodeHandle)
286N/A {
286N/A int nodeID = getNodeIdent(nodeHandle);
286N/A if (nodeID == RTF_ROOT || nodeID == RTF_TEXT)
286N/A return _text;
286N/A else
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public void copy(final int node, SerializationHandler handler)
286N/A throws TransletException
286N/A {
286N/A characters(node, handler);
286N/A }
286N/A
286N/A public void copy(DTMAxisIterator nodes, SerializationHandler handler)
286N/A throws TransletException
286N/A {
286N/A int node;
286N/A while ((node = nodes.next()) != DTM.NULL)
286N/A {
286N/A copy(node, handler);
286N/A }
286N/A }
286N/A
286N/A public String shallowCopy(final int node, SerializationHandler handler)
286N/A throws TransletException
286N/A {
286N/A characters(node, handler);
286N/A return null;
286N/A }
286N/A
286N/A public boolean lessThan(final int node1, final int node2)
286N/A {
286N/A if (node1 == DTM.NULL) {
286N/A return false;
286N/A }
286N/A else if (node2 == DTM.NULL) {
286N/A return true;
286N/A }
286N/A else
286N/A return (node1 < node2);
286N/A }
286N/A
286N/A /**
286N/A * Dispatch the character content of a node to an output handler.
286N/A *
286N/A * The escape setting should be taken care of when outputting to
286N/A * a handler.
286N/A */
286N/A public void characters(final int node, SerializationHandler handler)
286N/A throws TransletException
286N/A {
286N/A int nodeID = getNodeIdent(node);
286N/A if (nodeID == RTF_ROOT || nodeID == RTF_TEXT) {
286N/A boolean escapeBit = false;
286N/A boolean oldEscapeSetting = false;
286N/A
286N/A try {
286N/A for (int i = 0; i < _size; i++) {
286N/A
286N/A if (_dontEscape != null) {
286N/A escapeBit = _dontEscape.getBit(i);
286N/A if (escapeBit) {
286N/A oldEscapeSetting = handler.setEscaping(false);
286N/A }
286N/A }
286N/A
286N/A handler.characters(_textArray[i]);
286N/A
286N/A if (escapeBit) {
286N/A handler.setEscaping(oldEscapeSetting);
286N/A }
286N/A }
286N/A } catch (SAXException e) {
286N/A throw new TransletException(e);
286N/A }
286N/A }
286N/A }
286N/A
286N/A // %REVISIT% Can the makeNode() and makeNodeList() interfaces ever get used?
286N/A public Node makeNode(int index)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public Node makeNode(DTMAxisIterator iter)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public NodeList makeNodeList(int index)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public NodeList makeNodeList(DTMAxisIterator iter)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public String getLanguage(int node)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public int getSize()
286N/A {
286N/A return 2;
286N/A }
286N/A
286N/A public String getDocumentURI(int node)
286N/A {
286N/A return "simple_rtf" + _documentURIIndex++;
286N/A }
286N/A
286N/A public void setFilter(StripFilter filter)
286N/A {
286N/A }
286N/A
286N/A public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces)
286N/A {
286N/A }
286N/A
286N/A public boolean isElement(final int node)
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public boolean isAttribute(final int node)
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public String lookupNamespace(int node, String prefix)
286N/A throws TransletException
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A /**
286N/A * Return the node identity from a node handle.
286N/A */
286N/A public int getNodeIdent(final int nodehandle)
286N/A {
286N/A return (nodehandle != DTM.NULL) ? (nodehandle - _documentID) : DTM.NULL;
286N/A }
286N/A
286N/A /**
286N/A * Return the node handle from a node identity.
286N/A */
286N/A public int getNodeHandle(final int nodeId)
286N/A {
286N/A return (nodeId != DTM.NULL) ? (nodeId + _documentID) : DTM.NULL;
286N/A }
286N/A
286N/A public DOM getResultTreeFrag(int initialSize, int rtfType)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToManager)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public SerializationHandler getOutputDomBuilder()
286N/A {
286N/A return this;
286N/A }
286N/A
286N/A public int getNSType(int node)
286N/A {
286N/A return 0;
286N/A }
286N/A
286N/A public String getUnparsedEntityURI(String name)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public Hashtable getElementsWithIDs()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A /** Implementation of the SerializationHandler interfaces **/
286N/A
286N/A /**
286N/A * We only need to override the endDocument, characters, and
286N/A * setEscaping interfaces. A simple RTF does not have element
286N/A * nodes. We do not need to touch startElement and endElement.
286N/A */
286N/A
286N/A public void startDocument() throws SAXException
286N/A {
286N/A
286N/A }
286N/A
286N/A public void endDocument() throws SAXException
286N/A {
286N/A // Set the String value when the document is built.
286N/A if (_size == 1)
286N/A _text = _textArray[0];
286N/A else {
286N/A StringBuffer buffer = new StringBuffer();
286N/A for (int i = 0; i < _size; i++) {
286N/A buffer.append(_textArray[i]);
286N/A }
286N/A _text = buffer.toString();
286N/A }
286N/A }
286N/A
286N/A public void characters(String str) throws SAXException
286N/A {
286N/A // Resize the text array if necessary
286N/A if (_size >= _textArray.length) {
286N/A String[] newTextArray = new String[_textArray.length * 2];
286N/A System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length);
286N/A _textArray = newTextArray;
286N/A }
286N/A
286N/A // If the escape setting is false, set the corresponding bit in
286N/A // the _dontEscape BitArray.
286N/A if (!_escaping) {
286N/A // The _dontEscape array is only created when needed.
286N/A if (_dontEscape == null) {
286N/A _dontEscape = new BitArray(8);
286N/A }
286N/A
286N/A // Resize the _dontEscape array if necessary
286N/A if (_size >= _dontEscape.size())
286N/A _dontEscape.resize(_dontEscape.size() * 2);
286N/A
286N/A _dontEscape.setBit(_size);
286N/A }
286N/A
286N/A _textArray[_size++] = str;
286N/A }
286N/A
286N/A public void characters(char[] ch, int offset, int length)
286N/A throws SAXException
286N/A {
286N/A if (_size >= _textArray.length) {
286N/A String[] newTextArray = new String[_textArray.length * 2];
286N/A System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length);
286N/A _textArray = newTextArray;
286N/A }
286N/A
286N/A if (!_escaping) {
286N/A if (_dontEscape == null) {
286N/A _dontEscape = new BitArray(8);
286N/A }
286N/A
286N/A if (_size >= _dontEscape.size())
286N/A _dontEscape.resize(_dontEscape.size() * 2);
286N/A
286N/A _dontEscape.setBit(_size);
286N/A }
286N/A
286N/A _textArray[_size++] = new String(ch, offset, length);
286N/A
286N/A }
286N/A
286N/A public boolean setEscaping(boolean escape) throws SAXException
286N/A {
286N/A final boolean temp = _escaping;
286N/A _escaping = escape;
286N/A return temp;
286N/A }
286N/A
286N/A /** Implementation of the DTM interfaces **/
286N/A
286N/A /**
286N/A * The DTM interfaces are not used in this class. Implementing the DTM
286N/A * interface is a requirement from MultiDOM. If we have a better way
286N/A * of handling multiple documents, we can get rid of the DTM dependency.
286N/A *
286N/A * The following interfaces are just placeholders. The implementation
286N/A * does not have an impact because they will not be used.
286N/A */
286N/A
286N/A public void setFeature(String featureId, boolean state)
286N/A {
286N/A }
286N/A
286N/A public void setProperty(String property, Object value)
286N/A {
286N/A }
286N/A
286N/A public DTMAxisTraverser getAxisTraverser(final int axis)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public boolean hasChildNodes(int nodeHandle)
286N/A {
286N/A return (getNodeIdent(nodeHandle) == RTF_ROOT);
286N/A }
286N/A
286N/A public int getFirstChild(int nodeHandle)
286N/A {
286N/A int nodeID = getNodeIdent(nodeHandle);
286N/A if (nodeID == RTF_ROOT)
286N/A return getNodeHandle(RTF_TEXT);
286N/A else
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getLastChild(int nodeHandle)
286N/A {
286N/A return getFirstChild(nodeHandle);
286N/A }
286N/A
286N/A public int getAttributeNode(int elementHandle, String namespaceURI, String name)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getFirstAttribute(int nodeHandle)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getNextSibling(int nodeHandle)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getPreviousSibling(int nodeHandle)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getNextAttribute(int nodeHandle)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getNextNamespaceNode(int baseHandle, int namespaceHandle,
286N/A boolean inScope)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public int getOwnerDocument(int nodeHandle)
286N/A {
286N/A return getDocument();
286N/A }
286N/A
286N/A public int getDocumentRoot(int nodeHandle)
286N/A {
286N/A return getDocument();
286N/A }
286N/A
286N/A public XMLString getStringValue(int nodeHandle)
286N/A {
286N/A return new XMLStringDefault(getStringValueX(nodeHandle));
286N/A }
286N/A
286N/A public int getStringValueChunkCount(int nodeHandle)
286N/A {
286N/A return 0;
286N/A }
286N/A
286N/A public char[] getStringValueChunk(int nodeHandle, int chunkIndex,
286N/A int[] startAndLen)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public int getExpandedTypeID(String namespace, String localName, int type)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public String getLocalNameFromExpandedNameID(int ExpandedNameID)
286N/A {
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public String getNamespaceFromExpandedNameID(int ExpandedNameID)
286N/A {
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public String getLocalName(int nodeHandle)
286N/A {
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public String getPrefix(int nodeHandle)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public String getNamespaceURI(int nodeHandle)
286N/A {
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public String getNodeValue(int nodeHandle)
286N/A {
286N/A return (getNodeIdent(nodeHandle) == RTF_TEXT) ? _text : null;
286N/A }
286N/A
286N/A public short getNodeType(int nodeHandle)
286N/A {
286N/A int nodeID = getNodeIdent(nodeHandle);
286N/A if (nodeID == RTF_TEXT)
286N/A return DTM.TEXT_NODE;
286N/A else if (nodeID == RTF_ROOT)
286N/A return DTM.ROOT_NODE;
286N/A else
286N/A return DTM.NULL;
286N/A
286N/A }
286N/A
286N/A public short getLevel(int nodeHandle)
286N/A {
286N/A int nodeID = getNodeIdent(nodeHandle);
286N/A if (nodeID == RTF_TEXT)
286N/A return 2;
286N/A else if (nodeID == RTF_ROOT)
286N/A return 1;
286N/A else
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public boolean isSupported(String feature, String version)
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public String getDocumentBaseURI()
286N/A {
286N/A return EMPTY_STR;
286N/A }
286N/A
286N/A public void setDocumentBaseURI(String baseURI)
286N/A {
286N/A }
286N/A
286N/A public String getDocumentSystemIdentifier(int nodeHandle)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public String getDocumentEncoding(int nodeHandle)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public String getDocumentStandalone(int nodeHandle)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public String getDocumentVersion(int documentHandle)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public boolean getDocumentAllDeclarationsProcessed()
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public String getDocumentTypeDeclarationSystemIdentifier()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public String getDocumentTypeDeclarationPublicIdentifier()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public int getElementById(String elementId)
286N/A {
286N/A return DTM.NULL;
286N/A }
286N/A
286N/A public boolean supportsPreStripping()
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle)
286N/A {
286N/A return lessThan(firstNodeHandle, secondNodeHandle);
286N/A }
286N/A
286N/A public boolean isCharacterElementContentWhitespace(int nodeHandle)
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public boolean isDocumentAllDeclarationsProcessed(int documentHandle)
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public boolean isAttributeSpecified(int attributeHandle)
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public void dispatchCharactersEvents(
286N/A int nodeHandle,
286N/A org.xml.sax.ContentHandler ch,
286N/A boolean normalize)
286N/A throws org.xml.sax.SAXException
286N/A {
286N/A }
286N/A
286N/A public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch)
286N/A throws org.xml.sax.SAXException
286N/A {
286N/A }
286N/A
286N/A public org.w3c.dom.Node getNode(int nodeHandle)
286N/A {
286N/A return makeNode(nodeHandle);
286N/A }
286N/A
286N/A public boolean needsTwoThreads()
286N/A {
286N/A return false;
286N/A }
286N/A
286N/A public org.xml.sax.ContentHandler getContentHandler()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public org.xml.sax.ext.LexicalHandler getLexicalHandler()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public org.xml.sax.EntityResolver getEntityResolver()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public org.xml.sax.DTDHandler getDTDHandler()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public org.xml.sax.ErrorHandler getErrorHandler()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public org.xml.sax.ext.DeclHandler getDeclHandler()
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public void appendChild(int newChild, boolean clone, boolean cloneDepth)
286N/A {
286N/A }
286N/A
286N/A public void appendTextChild(String str)
286N/A {
286N/A }
286N/A
286N/A public SourceLocator getSourceLocatorFor(int node)
286N/A {
286N/A return null;
286N/A }
286N/A
286N/A public void documentRegistration()
286N/A {
286N/A }
286N/A
286N/A public void documentRelease()
286N/A {
286N/A }
286N/A
286N/A public void migrateTo(DTMManager manager)
286N/A {
286N/A }
286N/A}