286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 1999-2005 The Apache Software Foundation. 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 * 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 * SAX2DTM2 is an optimized version of SAX2DTM which is used in non-incremental situation. 286N/A * It is used as the super class of the XSLTC SAXImpl. Many of the interfaces in SAX2DTM 286N/A * and DTMDefaultBase are overridden in SAX2DTM2 in order to allow fast, efficient 286N/A * access to the DTM model. Some nested iterators in DTMDefaultBaseIterators 286N/A * are also overridden in SAX2DTM2 for performance reasons. 286N/A * Performance is the biggest consideration in the design of SAX2DTM2. To make the code most 286N/A * efficient, the incremental support is dropped in SAX2DTM2, which means that you should not 286N/A * use it in incremental situation. To reduce the overhead of pulling data from the DTM model, 286N/A * a few core interfaces in SAX2DTM2 have direct access to the internal arrays of the 286N/A * SuballocatedIntVectors. 286N/A * The design of SAX2DTM2 may limit its extensibilty. If you have a reason to extend the 286N/A * SAX2DTM model, please extend from SAX2DTM instead of this class. 286N/A * TODO: This class is currently only used by XSLTC. We need to investigate the possibility 286N/A * of also using it in Xalan-J Interpretive. Xalan's performance is likely to get an instant 286N/A * boost if we use SAX2DTM2 instead of SAX2DTM in non-incremental case. 286N/A * %MK% The code in this class is critical to the XSLTC_DTM performance. Be very careful 286N/A * when making changes here! 286N/A /**************************************************************** 286N/A * Optimized version of the nested iterators 286N/A ****************************************************************/ 286N/A * Iterator that returns all immediate children of a given node 286N/A * Setting start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * If the iterator is not restartable, this has no effect. 286N/A * or set current node to END, to indicate request-not-honored? 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END if no more 286N/A }
// end of ChildrenIterator 286N/A * Iterator that returns the parent of a given node. Note that 286N/A * this delivers only a single node; if you want all the ancestors, 286N/A * see AncestorIterator. 286N/A /** The extended type ID that was requested. */ 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A * Set the node type of the parent that we're looking for. 286N/A * Note that this does _not_ mean "find the nearest ancestor of 286N/A * this type", but "yield the parent if it is of this type". 286N/A * @param type extended type ID. 286N/A * @return ParentIterator configured with the type filter set. 286N/A * Get the next node in the iteration. In this case, we return 286N/A * only the immediate parent, _if_ it matches the requested nodeType. 286N/A * @return The next node handle in the iteration, or END. 286N/A // %OPT% The most common case is handled first. 286N/A }
// end of ParentIterator 286N/A * Iterator that returns children of a given type for a given node. 286N/A * The functionality chould be achieved by putting a filter on top 286N/A * of a basic child iterator, but a specialised iterator is used 286N/A * for efficiency (both speed and size of translet). 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedChildrenIterator 286N/A * @param nodeType The extended type ID being requested. 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A // %OPT% If the nodeType is element (matching child::*), we only 286N/A // need to compare the expType with DTM.NTYPES. A child node of 286N/A // an element can be either an element, text, comment or 286N/A // processing instruction node. Only element node has an extended 286N/A // type greater than or equal to DTM.NTYPES. 286N/A * Return the node at the given position. 286N/A }
// end of TypedChildrenIterator 286N/A * Iterator that returns the namespace nodes as defined by the XPath data model 286N/A * for a given node, filtered by extended type ID. 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedRootIterator 286N/A * @param nodeType The extended type ID being requested. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of TypedRootIterator 286N/A * Iterator that returns all siblings of a given node. 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of FollowingSiblingIterator 286N/A * Iterator that returns all following siblings of a given node. 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedFollowingSiblingIterator 286N/A * @param type The extended type ID being requested. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of TypedFollowingSiblingIterator 286N/A * Iterator that returns attribute nodes (of what nodes?) 286N/A // assumes caller will pass element nodes 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of AttributeIterator 286N/A * Iterator that returns attribute nodes of a given type 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedAttributeIterator 286N/A * @param nodeType The extended type ID that is requested. 286N/A // assumes caller will pass element nodes 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A // singleton iterator, since there can only be one attribute of 286N/A }
// end of TypedAttributeIterator 286N/A * Iterator that returns preceding siblings of a given node 286N/A * The node identity of _startNode for this iterator 286N/A * True if this iterator has a reversed axis. 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A // Be careful to handle the Document node properly 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of PrecedingSiblingIterator 286N/A * Iterator that returns preceding siblings of a given type for 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedPrecedingSiblingIterator 286N/A * @param type The extended type ID being requested. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A * Return the index of the last node in this iterator. 286N/A }
// end of TypedPrecedingSiblingIterator 286N/A * Iterator that returns preceding nodes of a given node. 286N/A * This includes the node set {root+1, start-1}, but excludes 286N/A * all ancestors, attributes, and namespace nodes. 286N/A /** The max ancestors, but it can grow... */ 286N/A * The stack of start node + ancestors up to the root of the tree, 286N/A /** (not sure yet... -sb) */ 286N/A /* _currentNode precedes candidates. This is the identity, not the handle! */ 286N/A * True if this iterator has a reversed axis. 286N/A * @return true since this iterator is a reversed axis. 286N/A * Returns a deep copy of this iterator. The cloned iterator is not reset. 286N/A * @return a deep copy of this iterator. 286N/A // return clone.reset(); 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A // iterator is not a clone 286N/A --
index;
// Pop actual root node (if not start) back off the stack 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A // Bugzilla 8324: We were forgetting to skip Attrs and NS nodes. 286N/A // Also recoded the loop controls for clarity and to flatten out 286N/A // redefine DTMAxisIteratorBase's reset 286N/A * Resets the iterator to the last start node. 286N/A * @return A DTMAxisIterator, which may or may not be the same as this 286N/A }
// end of PrecedingIterator 286N/A * Iterator that returns preceding nodes of agiven type for a 286N/A * given node. This includes the node set {root+1, start-1}, but 286N/A * excludes all ancestors. 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedPrecedingIterator 286N/A * @param type The extended type ID being requested. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of TypedPrecedingIterator 286N/A * Iterator that returns following nodes of for a given node. 286N/A //DTMAxisTraverser m_traverser; // easier for now 286N/A //m_traverser = getAxisTraverser(Axis.FOLLOWING); 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A //_currentNode = m_traverser.first(node); 286N/A // _currentNode precedes possible following(node) nodes 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A //_currentNode = m_traverser.next(_startNode, _currentNode); 286N/A }
// end of FollowingIterator 286N/A * Iterator that returns following nodes of a given type for a given node. 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedFollowingIterator 286N/A * @param type The extended type ID being requested. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of TypedFollowingIterator 286N/A * Iterator that returns the ancestors of a given node in document 286N/A * order. (NOTE! This was changed from the XSLTC code!) 286N/A // The initial size of the ancestor array 286N/A // The array for ancestor nodes. This array will grow dynamically. 286N/A // Number of ancestor nodes in the array 286N/A /** The real start node for this axes, since _startNode will be adjusted. */ 286N/A * Get start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @return The root node of the iteration. 286N/A * True if this iterator has a reversed axis. 286N/A * @return true since this iterator is a reversed axis. 286N/A * Returns a deep copy of this iterator. The cloned iterator is not reset. 286N/A * @return a deep copy of this iterator. 286N/A // return clone.reset(); 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A // Start from the current node's parent if 286N/A // _includeSelf is false. 286N/A //m_ancestors.addElement(node); 286N/A * Resets the iterator to the last start node. 286N/A * @return A DTMAxisIterator, which may or may not be the same as this 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of AncestorIterator 286N/A * Typed iterator that returns the ancestors of a given node. 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedAncestorIterator 286N/A * @param type The extended type ID being requested. 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A * Return the node at the given position. 286N/A * Returns the position of the last node within the iteration, as 286N/A }
// end of TypedAncestorIterator 286N/A * Iterator that returns the descendants of a given node. 286N/A * Set start to END should 'close' the iterator, 286N/A * i.e. subsequent call to next() should return END. 286N/A * @param node Sets the root of the iteration. 286N/A * @return A DTMAxisIterator set to the start of the iteration. 286N/A//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily 286N/A * Tell if this node identity is a descendant. Assumes that 286N/A * the node info for the element has already been obtained. 286N/A * This one-sided test works only if the parent has been 286N/A * previously tested and is known to be a descendent. It fails if 286N/A * the parent is the _startNode's next sibling, or indeed any node 286N/A * that follows _startNode in document order. That may suffice 286N/A * for this iterator, but it's not really an isDescendent() test. 286N/A * @param identity The index number of the node in question. 286N/A * @return true if the index is a descendant of _startNode. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A // %OPT% If the startNode is the root node, do not need 286N/A // to do the isDescendant() check. 286N/A }
// end of DescendantIterator 286N/A * Typed iterator that returns the descendants of a given node. 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedDescendantIterator 286N/A * @param nodeType Extended type ID being requested. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A // %OPT% If the start node is root (e.g. in the case of //node), 286N/A // we can save the isDescendant() check, because all nodes are 286N/A // descendants of root. 286N/A }
// end of TypedDescendantIterator 286N/A * Iterator that returns a given node only if it is of a given type. 286N/A /** The extended type ID that was requested. */ 286N/A * Constructor TypedSingletonIterator 286N/A * @param nodeType The extended type ID being requested. 286N/A * Get the next node in the iteration. 286N/A * @return The next node handle in the iteration, or END. 286N/A }
// end of TypedSingletonIterator 286N/A /******************************************************************* 286N/A * End of nested iterators 286N/A *******************************************************************/ 286N/A // %OPT% Array references which are used to cache the map0 arrays in 286N/A // SuballocatedIntVectors. Using the cached arrays reduces the level 286N/A // of indirection and results in better performance than just calling 286N/A // SuballocatedIntVector.elementAt(). 286N/A // Double array references to the map arrays in SuballocatedIntVectors. 286N/A // %OPT% Cache the array of extended types in this class 286N/A // A Vector which is used to store the values of attribute, namespace, 286N/A // comment and PI nodes. 286N/A // %OPT% These values are unlikely to be equal. Storing 286N/A // them in a plain Vector is more efficient than storing in the 286N/A // DTMStringPool because we can save the cost for hash calculation. 286N/A // %REVISIT% Do we need a custom class (e.g. StringVector) here? 286N/A // The current index into the m_values Vector. 286N/A // The maximum value of the current node index. 286N/A // Cache the shift and mask values for the SuballocatedIntVectors. 286N/A /** %OPT% If the offset and length of a Text node are within certain limits, 286N/A * we store a bitwise encoded value into an int, using 10 bits (max. 1024) 286N/A * for length and 21 bits for offset. We can save two SuballocatedIntVector 286N/A * calls for each getStringValueX() and dispatchCharacterEvents() call by 286N/A // The number of bits for the length of a Text node. 286N/A // The number of bits for the offset of a Text node. 286N/A // The maximum length value 286N/A // The maximum offset value 286N/A // True if we want to build the ID index table. 286N/A // Constant for empty String 286N/A // Constant for empty XMLString 286N/A * Construct a SAX2DTM2 object using the default block size. 286N/A * Construct a SAX2DTM2 object using the given block size. 286N/A // Initialize the values of m_SHIFT and m_MASK. 286N/A // Some documents do not have attribute nodes. That is why 286N/A // we set the initial size of this Vector to be small and set 286N/A // the increment to a bigger number. 286N/A // Set the map0 values in the constructor. 286N/A * Override DTMDefaultBase._exptype() by dropping the incremental code. 286N/A * <p>This one is less efficient than _exptype2. It is only used during 286N/A * DTM building. _exptype2 is used after the document is fully built. 286N/A /************************************************************************ 286N/A * DTM base accessor interfaces 286N/A * %OPT% The code in the following interfaces (e.g. _exptype2, etc.) are 286N/A * very important to the DTM performance. To have the best performace, 286N/A * these several interfaces have direct access to the internal arrays of 286N/A * the SuballocatedIntVectors. The final modifier also has a noticeable 286N/A * impact on performance. 286N/A ***********************************************************************/ 286N/A * The optimized version of DTMDefaultBase._exptype(). 286N/A * @param identity A node identity, which <em>must not</em> be equal to 286N/A * <code>DTM.NULL</code> 286N/A //return m_exptype.elementAt(identity); 286N/A * The optimized version of DTMDefaultBase._nextsib(). 286N/A * @param identity A node identity, which <em>must not</em> be equal to 286N/A * <code>DTM.NULL</code> 286N/A //return m_nextsib.elementAt(identity); 286N/A * The optimized version of DTMDefaultBase._firstch(). 286N/A * @param identity A node identity, which <em>must not</em> be equal to 286N/A * <code>DTM.NULL</code> 286N/A //return m_firstch.elementAt(identity); 286N/A * The optimized version of DTMDefaultBase._parent(). 286N/A * @param identity A node identity, which <em>must not</em> be equal to 286N/A * <code>DTM.NULL</code> 286N/A //return m_parent.elementAt(identity); 286N/A * The optimized version of DTMDefaultBase._type(). 286N/A * @param identity A node identity, which <em>must not</em> be equal to 286N/A * <code>DTM.NULL</code> 286N/A //int eType = _exptype2(identity); 286N/A * The optimized version of DTMDefaultBase.getExpandedTypeID(int). 286N/A * <p>This one is only used by DOMAdapter.getExpandedTypeID(int), which 286N/A * is mostly called from the compiled translets. 286N/A //return (nodeID != NULL) ? _exptype2(nodeID) : NULL; 286N/A /************************************************************************* 286N/A * END of DTM base accessor interfaces 286N/A *************************************************************************/ 286N/A * Return the node type from the expanded type 286N/A * Get a prefix either from the uri mapping, or just make 286N/A * @param uri The namespace URI, which may be null. 286N/A * @return The prefix if there is one, or null. 286N/A * Override SAX2DTM.startElement() 286N/A * <p>Receive notification of the start of an element. 286N/A * <p>By default, do nothing. Application writers may override this 286N/A * method in a subclass to take specific actions at the start of 286N/A * each element (such as allocating a new tree node or writing 286N/A * output to a file).</p> 286N/A * @param uri The Namespace URI, or the empty string if the 286N/A * element has no Namespace URI or if Namespace 286N/A * processing is not being performed. 286N/A * @param localName The local name (without prefix), or the 286N/A * empty string if Namespace processing is not being 286N/A * @param qName The qualified name (with prefix), or the 286N/A * empty string if qualified names are not available. 286N/A * @param attributes The specified or defaulted attributes. 286N/A * @throws SAXException Any SAX exception, possibly 286N/A * wrapping another exception. 286N/A // SPECIAL CASE: Implied declaration at root element 286N/A for (
int i =
0; i < n; i++)
286N/A continue;
// go to the next attribute. 286N/A // Bit of a hack... if somehow valString is null, stringToIndex will 286N/A // return -1, which will make things very unhappy. 286N/A * Receive notification of the end of an element. 286N/A * <p>By default, do nothing. Application writers may override this 286N/A * method in a subclass to take specific actions at the end of 286N/A * each element (such as finalising a tree node or writing 286N/A * output to a file).</p> 286N/A * @param uri The Namespace URI, or the empty string if the 286N/A * element has no Namespace URI or if Namespace 286N/A * processing is not being performed. 286N/A * @param localName The local name (without prefix), or the 286N/A * empty string if Namespace processing is not being 286N/A * @param qName The qualified XML 1.0 name (with prefix), or the 286N/A * empty string if qualified names are not available. 286N/A * @throws SAXException Any SAX exception, possibly 286N/A * wrapping another exception. 286N/A // If no one noticed, startPrefixMapping is a drag. 286N/A // Pop the context for the last child (the one pushed by startElement) 286N/A // Do it again for this one (the one pushed by the last endElement). 286N/A * Report an XML comment anywhere in the document. 286N/A * <p>This callback will be used for comments inside or outside the 286N/A * document element, including comments in the external DTD 286N/A * subset (if read).</p> 286N/A * @param ch An array holding the characters in the comment. 286N/A * @param start The starting position in the array. 286N/A * @param length The number of characters to use from the array. 286N/A * @throws SAXException The application may raise an exception. 286N/A // %OPT% Saving the comment string in a Vector has a lower cost than 286N/A // saving it in DTMStringPool. 286N/A * Receive notification of the beginning of the document. 286N/A * @throws SAXException Any SAX exception, possibly 286N/A * wrapping another exception. 286N/A * Receive notification of the end of the document. 286N/A * @throws SAXException Any SAX exception, possibly 286N/A * wrapping another exception. 286N/A // Add a NULL entry to the end of the node arrays as 286N/A // Set the cached references after the document is built. 286N/A * Construct the node map from the node. 286N/A * @param type raw type ID, one of DTM.XXX_NODE. 286N/A * @param expandedTypeID The expended type ID. 286N/A * @param parentIndex The current parent index. 286N/A * @param previousSibling The previous sibling index. 286N/A * @param dataOrPrefix index into m_data table, or string handle. 286N/A * @param canHaveFirstChild true if the node can have a first child, false 286N/A * @return The index identity of the node that was added. 286N/A // Common to all nodes: 286N/A // Have we overflowed a DTM Identity's addressing range? 286N/A //if(m_dtmIdent.size() == (nodeIndex>>>DTMManager.IDENT_DTM_NODE_BITS)) 286N/A // Note that nextSibling is not processed until charactersFlush() 286N/A // is called, to handle successive characters() events. 286N/A // Special handling by type: Declare namespaces, attach first child 286N/A * Check whether accumulated text should be stripped; if not, 286N/A // contained no characters. They should not result in a node. 286N/A // If the offset and length do not exceed the given limits 286N/A // (offset < 2^21 and length < 2^10), then save both the offset 286N/A // and length in a bitwise encoded value. 286N/A // Store offset and length in the m_data array if one exceeds 286N/A // the given limits. Use a negative dataIndex as an indication. 286N/A // Reset for next text block 286N/A * Override the processingInstruction() interface in SAX2DTM2. 286N/A * %OPT% This one is different from SAX2DTM.processingInstruction() 286N/A * in that we do not use extended types for PI nodes. The name of 286N/A * the PI is saved in the DTMStringPool. 286N/A * Receive notification of a processing instruction. 286N/A * @param target The processing instruction target. 286N/A * @param data The processing instruction data, or null if 286N/A * @throws SAXException Any SAX exception, possibly 286N/A * wrapping another exception. 286N/A * The optimized version of DTMDefaultBase.getFirstAttribute(). 286N/A * Given a node handle, get the index of the node's first attribute. 286N/A * @param nodeHandle int Handle of the node. 286N/A * @return Handle of first attribute, or DTM.NULL to indicate none exists. 286N/A // Assume that attributes and namespaces immediately follow the element. 286N/A // Assume this can not be null. 286N/A * The optimized version of DTMDefaultBase.getFirstAttributeIdentity(int). 286N/A * Given a node identity, get the index of the node's first attribute. 286N/A * @param identity int identity of the node. 286N/A * @return Identity of first attribute, or DTM.NULL to indicate none exists. 286N/A // Assume that attributes and namespaces immediately follow the element. 286N/A // Assume this can not be null. 286N/A * The optimized version of DTMDefaultBase.getNextAttributeIdentity(int). 286N/A * Given a node identity for an attribute, advance to the next attribute. 286N/A * @param identity int identity of the attribute node. This 286N/A * <strong>must</strong> be an attribute node. 286N/A * @return int DTM node-identity of the resolved attr, 286N/A * or DTM.NULL to indicate none exists. 286N/A // Assume that attributes and namespace nodes immediately follow the element 286N/A * The optimized version of DTMDefaultBase.getTypedAttribute(int, int). 286N/A * Given a node handle and an expanded type ID, get the index of the node's 286N/A * attribute of that type, if any. 286N/A * @param nodeHandle int Handle of the node. 286N/A * @param attType int expanded type ID of the required attribute. 286N/A * @return Handle of attribute of the required type, or DTM.NULL to indicate 286N/A * Override SAX2DTM.getLocalName() in SAX2DTM2. 286N/A * <p>Processing for PIs is different. 286N/A * Given a node handle, return its XPath- style localname. (As defined in 286N/A * Namespaces, this is the portion of the name after any colon character). 286N/A * @param nodeHandle the id of the node. 286N/A * @return String Local name of this node. 286N/A * The optimized version of SAX2DTM.getNodeNameX(). 286N/A * Given a node handle, return the XPath node name. This should be the name 286N/A * as described by the XPath data model, NOT the DOM- style name. 286N/A * @param nodeHandle the id of the node. 286N/A * @return String Name of this node, which may be an empty string. 286N/A * The optimized version of SAX2DTM.getNodeName(). 286N/A * Given a node handle, return its DOM-style node name. This will include 286N/A * names such as #text or #document. 286N/A * @param nodeHandle the id of the node. 286N/A * @return String Name of this node, which may be an empty string. 286N/A * %REVIEW% Document when empty string is possible... 286N/A * %REVIEW-COMMENT% It should never be empty, should it? 286N/A * Override SAX2DTM.getStringValue(int) 286N/A * This method is only used by Xalan-J Interpretive. It is not used by XSLTC. 286N/A * If the caller supplies an XMLStringFactory, the getStringValue() interface 286N/A * in SAX2DTM will be called. Otherwise just calls getStringValueX() and 286N/A * wraps the returned String in an XMLString. 286N/A * Get the string-value of a node as a String object 286N/A * for the definition of a node's string-value). 286N/A * @param nodeHandle The node ID. 286N/A * @return A string object that represents the string-value of the given node. 286N/A * The optimized version of SAX2DTM.getStringValue(int). 286N/A * %OPT% This is one of the most often used interfaces. Performance is 286N/A * critical here. This one is different from SAX2DTM.getStringValue(int) in 286N/A * that it returns a String instead of a XMLString. 286N/A * Get the string- value of a node as a String object (see http: //www. w3. 286N/A * org/TR/xpath#data- model for the definition of a node's string- value). 286N/A * @param nodeHandle The node ID. 286N/A * @return A string object that represents the string-value of the given node. 286N/A * Returns the string value of the entire tree 286N/A // optimization: only create StringBuffer if > 1 child 286N/A * The optimized version of SAX2DTM.dispatchCharactersEvents(int, ContentHandler, boolean). 286N/A * characters method on the passed ContentHandler for the 286N/A * for the definition of a node's string-value). Multiple calls to the 286N/A * ContentHandler's characters methods may well occur for a single call to 286N/A * @param nodeHandle The node ID. 286N/A * @param ch A non-null reference to a ContentHandler. 286N/A * @param normalize true if the content should be normalized according to 286N/A * the rules for the XPath 286N/A * Given a node handle, return its node value. This is mostly 286N/A * as defined by the DOM, but may ignore some conveniences. 286N/A * @param nodeHandle The node id. 286N/A * @return String Value of this node, or null if not 286N/A * meaningful for this node type. 286N/A * Copy the String value of a Text node to a SerializationHandler 286N/A * Copy an Element node to a SerializationHandler. 286N/A * @param nodeID The node identity 286N/A * @param exptype The expanded type of the Element node 286N/A * @param handler The SerializationHandler 286N/A * @return The qualified name of the Element node. 286N/A * Copy namespace nodes. 286N/A * @param nodeID The Element node identity 286N/A * @param handler The SerializationHandler 286N/A * @param inScope true if all namespaces in scope should be copied, 286N/A * false if only the namespace declarations should be copied. 286N/A // %OPT% Optimization for documents which does not have any explicit 286N/A // namespace nodes. For these documents, there is an implicit 286N/A // declared on the root element node. In this case, there is no 286N/A // need to do namespace copying. We can safely return without 286N/A // Find the first namespace node 286N/A // Retrieve the name of the namespace node 286N/A // Retrieve the node value of the namespace node 286N/A * Return the next namespace node following the given base node. 286N/A * @baseID The node identity of the base node, which can be an 286N/A * element, attribute or namespace node. 286N/A * @return The namespace node immediately following the base node. 286N/A * Copy attribute nodes from an element . 286N/A * @param nodeID The Element node identity 286N/A * @param handler The SerializationHandler 286N/A * Copy an Attribute node to a SerializationHandler 286N/A * @param nodeID The node identity 286N/A * @param exptype The expanded type of the Element node 286N/A * @param handler The SerializationHandler 286N/A final String uri = getNamespaceName(node); 286N/A if (uri.length() != 0) { 286N/A final String prefix = getPrefix(node); 286N/A handler.namespaceAfterStartElement(prefix, uri); 286N/A handler.addAttribute(getNodeName(node), getNodeValue(node));