/** * Override SAX2DTM.getLocalName() in SAX2DTM2. * <p>Processing for PIs is different. * * Given a node handle, return its XPath- style localname. (As defined in * Namespaces, this is the portion of the name after any colon character). * * @param nodeHandle the id of the node. * @return String Local name of this node. */ public String getLocalName(int nodeHandle) { int expType = _exptype(makeNodeIdentity(nodeHandle)); if (expType == DTM.PROCESSING_INSTRUCTION_NODE) { int dataIndex = _dataOrQName(makeNodeIdentity(nodeHandle)); dataIndex = m_data.elementAt(-dataIndex); return m_valuesOrPrefixes.indexToString(dataIndex); } else return m_expandedNameTable.getLocalName(expType); }
/** * Copy attribute nodes from an element . * * @param nodeID The Element node identity * @param handler The SerializationHandler */ protected final void copyAttributes(final int nodeID, SerializationHandler handler) throws SAXException{ for(int current = getFirstAttributeIdentity(nodeID); current != DTM.NULL; current = getNextAttributeIdentity(current)){ int eType = _exptype2(current); copyAttribute(current, eType, handler); } }
node = getDocument(); if (_isRestartable) node = _startNodeID = makeNodeIdentity(node); int type = _type2(node); if(ExpandedNameTable.ATTRIBUTE == type || ExpandedNameTable.NAMESPACE == type ) _currentNode = _parent2(node); if(NULL!=_currentNode) _currentNode = _firstch2(_currentNode); else _currentNode = node;
if (nodeType != DTM.ELEMENT_NODE) { while (node != DTM.NULL) { if (_exptype2(node) == nodeType) { pos++; if (pos == position) return makeNodeHandle(node); node = _nextsib2(node); if (_exptype2(node) >= DTM.NTYPES) { pos++; if (pos == position) return makeNodeHandle(node); node = _nextsib2(node);
/** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { _currentNode = (_currentNode == DTM.NULL) ? DTM.NULL : _nextsib2(_currentNode); return returnNode(makeNodeHandle(_currentNode)); } } // end of FollowingSiblingIterator
charactersFlush(); int elemNode = addNode(DTM.ELEMENT_NODE, exName, m_parents.peek(), m_previous, prefixIndex, true); indexNode(exName, elemNode); m_values.addElement(declURL); int val = m_valueIndex++; addNode(DTM.NAMESPACE_NODE, exName, elemNode, DTM.NULL, val, false); m_pastFirstElement=true; addNode(DTM.NAMESPACE_NODE, exName, elemNode, DTM.NULL, val, false); prefix = getPrefix(attrQName, attrUri); if (declAlreadyDeclared(prefix)) continue; // go to the next attribute. setIDAttribute(valString, elemNode); addNode(nodeType, exName, elemNode, DTM.NULL, val, false); short wsv = m_wsfilter.getShouldStripSpace(makeNodeHandle(elemNode), this); boolean shouldStrip = (DTMWSFilter.INHERIT == wsv) ? getShouldStripWhitespace() : (DTMWSFilter.STRIP == wsv);
int identity = makeNodeIdentity(nodeHandle); if (identity == DTM.NULL) return EMPTY_STR; int type= _type2(identity); identity = _firstch2(identity); if (DTM.NULL != identity) type = _exptype2(identity); } while (_parent2(identity) >= startNode);
node = getDocument(); if (_isRestartable) node = makeNodeIdentity(node); int type = _type2(node); node = _parent2(node); first = _firstch2(node); _currentNode = makeNodeHandle(first); return resetPosition(); first = _nextsib2(node); node = _parent2(node); _currentNode = makeNodeHandle(first);
node = getDocument(); m_realStartNode = node; int nodeID = makeNodeIdentity(node); m_size = 0; nodeID = _parent2(nodeID); node = makeNodeHandle(nodeID); nodeID = _parent2(nodeID); node = makeNodeHandle(nodeID);
/** * Returns the string value of the entire tree */ public String getStringValue() { int child = _firstch2(ROOTNODE); if (child == DTM.NULL) return EMPTY_STR; // optimization: only create StringBuffer if > 1 child if ((_exptype2(child) == DTM.TEXT_NODE) && (_nextsib2(child) == DTM.NULL)) { int dataIndex = m_dataOrQName.elementAt(child); if (dataIndex >= 0) return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); else return m_chars.getString(m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex + 1)); } else return getStringValueX(getDocument()); }
/** * Report an XML comment anywhere in the document. * * <p>This callback will be used for comments inside or outside the * document element, including comments in the external DTD * subset (if read).</p> * * @param ch An array holding the characters in the comment. * @param start The starting position in the array. * @param length The number of characters to use from the array. * @throws SAXException The application may raise an exception. */ public void comment(char ch[], int start, int length) throws SAXException { if (m_insideDTD) // ignore comments if we're inside the DTD return; charactersFlush(); // %OPT% Saving the comment string in a Vector has a lower cost than // saving it in DTMStringPool. m_values.addElement(new String(ch, start, length)); int dataIndex = m_valueIndex++; m_previous = addNode(DTM.COMMENT_NODE, DTM.COMMENT_NODE, m_parents.peek(), m_previous, dataIndex, false); }
/** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = (node == DTM.NULL) ? DTM.NULL : _firstch2(makeNodeIdentity(_startNode)); return resetPosition(); } return this; }
/** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; _currentNode = getFirstAttributeIdentity(makeNodeIdentity(node)); return resetPosition(); } return this; }
int nodeID = makeNodeIdentity(nodeHandle); int type = _type2(nodeID); type = _type2(nodeID); return makeNodeHandle(nodeID);
/** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { final int result = _currentNode; if (result == END) return DTM.NULL; _currentNode = END; if (_nodeType >= DTM.NTYPES) { if (_exptype2(makeNodeIdentity(result)) == _nodeType) { return returnNode(result); } } else { if (_type2(makeNodeIdentity(result)) == _nodeType) { return returnNode(result); } } return NULL; } } // end of TypedSingletonIterator
expType = _exptype2(node); if (NULL == expType || _parent2(node) < startNode && startNode != node) { _currentNode = NULL; return END; expType = _exptype2(node); expType = _exptype2(node); if (NULL == expType || _parent2(node) < startNode && startNode != node) { _currentNode = NULL; return END; return returnNode(makeNodeHandle(node));
return returnNode(makeNodeHandle(result)); if (_nodeType == _exptype2(result)) { _currentNode = END; return returnNode(makeNodeHandle(result)); if (_nodeType == _type2(result)) { _currentNode = END; return returnNode(makeNodeHandle(result));
/** * Set start to END should 'close' the iterator, * i.e. subsequent call to next() should return END. * * @param node Sets the root of the iteration. * * @return A DTMAxisIterator set to the start of the iteration. */ public DTMAxisIterator setStartNode(int node) { //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily if (node == DTMDefaultBase.ROOTNODE) node = getDocument(); if (_isRestartable) { _startNode = node; if (node != DTM.NULL) _currentNode = _parent2(makeNodeIdentity(node)); else _currentNode = DTM.NULL; return resetPosition(); } return this; }
/** * Get the next node in the iteration. * * @return The next node handle in the iteration, or END. */ public int next() { // Bugzilla 8324: We were forgetting to skip Attrs and NS nodes. // Also recoded the loop controls for clarity and to flatten out // the tail-recursion. for(++_currentNode; _sp>=0; ++_currentNode) { if(_currentNode < _stack[_sp]) { int type = _type2(_currentNode); if(type != ATTRIBUTE_NODE && type != NAMESPACE_NODE) return returnNode(makeNodeHandle(_currentNode)); } else --_sp; } return NULL; }