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