Java Code Examples for com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase#ROOTNODE

The following examples show how to use com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase#ROOTNODE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SAXImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 : NOTPROCESSED;

        return resetPosition();
    }

    return this;
}
 
Example 2
Source File: SAXImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 : NOTPROCESSED;

        return resetPosition();
    }

    return this;
}
 
Example 3
Source File: SAXImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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) {
        int nsType = _nsType;

        _startNode = node;

        for (node = getFirstAttribute(node);
             node != END;
             node = getNextAttribute(node)) {
            if (getNSType(node) == nsType) {
                break;
            }
        }

        _currentNode = node;
        return resetPosition();
    }

    return this;
}
 
Example 4
Source File: SAXImpl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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) {
        int nsType = _nsType;

        _startNode = node;

        for (node = getFirstAttribute(node);
             node != END;
             node = getNextAttribute(node)) {
            if (getNSType(node) == nsType) {
                break;
            }
        }

        _currentNode = node;
        return resetPosition();
    }

    return this;
}
 
Example 5
Source File: SAXImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 : NOTPROCESSED;

        return resetPosition();
    }

    return this;
}
 
Example 6
Source File: SAXImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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) {
        int nsType = _nsType;

        _startNode = node;

        for (node = getFirstAttribute(node);
             node != END;
             node = getNextAttribute(node)) {
            if (getNSType(node) == nsType) {
                break;
            }
        }

        _currentNode = node;
        return resetPosition();
    }

    return this;
}
 
Example 7
Source File: SAXImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a SAXImpl object using the given block size.
 */
public SAXImpl(XSLTCDTMManager mgr, Source source,
               int dtmIdentity, DTMWSFilter whiteSpaceFilter,
               XMLStringFactory xstringfactory,
               boolean doIndexing, int blocksize,
               boolean buildIdIndex,
               boolean newNameTable)
{
    super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory,
        doIndexing, blocksize, false, buildIdIndex, newNameTable);

    _dtmManager = mgr;
    _size = blocksize;

    // Use a smaller size for the space stack if the blocksize is small
    _xmlSpaceStack = new int[blocksize <= 64 ? 4 : 64];

    /* From DOMBuilder */
    _xmlSpaceStack[0] = DTMDefaultBase.ROOTNODE;

    // If the input source is DOMSource, set the _document field and
    // create the node2Ids table.
    if (source instanceof DOMSource) {
        _hasDOMSource = true;
        DOMSource domsrc = (DOMSource)source;
        Node node = domsrc.getNode();
        if (node instanceof Document) {
            _document = (Document)node;
        }
        else {
            _document = node.getOwnerDocument();
        }
        _node2Ids = new Hashtable();
    }
}
 
Example 8
Source File: AbsoluteIterator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator setStartNode(int node) {
    _startNode = DTMDefaultBase.ROOTNODE;
    if (_isRestartable) {
        _source.setStartNode(_startNode);
        resetPosition();
    }
    return this;
}
 
Example 9
Source File: SAX2DTM2.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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 = makeNodeIdentity(node);

    return resetPosition();
  }

  return this;
}
 
Example 10
Source File: AbsoluteIterator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator setStartNode(int node) {
    _startNode = DTMDefaultBase.ROOTNODE;
    if (_isRestartable) {
        _source.setStartNode(_startNode);
        resetPosition();
    }
    return this;
}
 
Example 11
Source File: SAX2DTM2.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 12
Source File: SAXImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a SAXImpl object using the given block size.
 */
public SAXImpl(XSLTCDTMManager mgr, Source source,
               int dtmIdentity, DTMWSFilter whiteSpaceFilter,
               XMLStringFactory xstringfactory,
               boolean doIndexing, int blocksize,
               boolean buildIdIndex,
               boolean newNameTable)
{
    super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory,
        doIndexing, blocksize, false, buildIdIndex, newNameTable);

    _dtmManager = mgr;
    _size = blocksize;

    // Use a smaller size for the space stack if the blocksize is small
    _xmlSpaceStack = new int[blocksize <= 64 ? 4 : 64];

    /* From DOMBuilder */
    _xmlSpaceStack[0] = DTMDefaultBase.ROOTNODE;

    // If the input source is DOMSource, set the _document field and
    // create the node2Ids table.
    if (source instanceof DOMSource) {
        _hasDOMSource = true;
        DOMSource domsrc = (DOMSource)source;
        Node node = domsrc.getNode();
        if (node instanceof Document) {
            _document = (Document)node;
        }
        else {
            _document = node.getOwnerDocument();
        }
        _node2Ids = new Hashtable();
    }
}
 
Example 13
Source File: SAX2DTM2.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
    node = _startNodeID = makeNodeIdentity(node);

    if(node == NULL) {
      _currentNode = node;
      return resetPosition();
    }

    int type = _type2(node);
    if (ExpandedNameTable.ATTRIBUTE == type ||
        ExpandedNameTable.NAMESPACE == type)
    {
      _currentNode = node;
    } else {
      // Be careful to handle the Document node properly
      _currentNode = _parent2(node);
      if(NULL!=_currentNode)
        _currentNode = _firstch2(_currentNode);
      else
        _currentNode = node;
    }

    return resetPosition();
  }

  return this;
}
 
Example 14
Source File: SAXImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a SAXImpl object using the given block size.
 */
public SAXImpl(XSLTCDTMManager mgr, Source source,
               int dtmIdentity, DTMWSFilter whiteSpaceFilter,
               XMLStringFactory xstringfactory,
               boolean doIndexing, int blocksize,
               boolean buildIdIndex,
               boolean newNameTable)
{
    super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory,
        doIndexing, blocksize, false, buildIdIndex, newNameTable);

    _dtmManager = mgr;
    _size = blocksize;

    // Use a smaller size for the space stack if the blocksize is small
    _xmlSpaceStack = new int[blocksize <= 64 ? 4 : 64];

    /* From DOMBuilder */
    _xmlSpaceStack[0] = DTMDefaultBase.ROOTNODE;

    // If the input source is DOMSource, set the _document field and
    // create the node2Ids table.
    if (source instanceof DOMSource) {
        _hasDOMSource = true;
        DOMSource domsrc = (DOMSource)source;
        Node node = domsrc.getNode();
        if (node instanceof Document) {
            _document = (Document)node;
        }
        else {
            _document = node.getOwnerDocument();
        }
        _node2Ids = new HashMap<>();
    }
}
 
Example 15
Source File: AbsoluteIterator.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public DTMAxisIterator setStartNode(int node) {
    _startNode = DTMDefaultBase.ROOTNODE;
    if (_isRestartable) {
        _source.setStartNode(_startNode);
        resetPosition();
    }
    return this;
}
 
Example 16
Source File: AbsoluteIterator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisIterator setStartNode(int node) {
    _startNode = DTMDefaultBase.ROOTNODE;
    if (_isRestartable) {
        _source.setStartNode(_startNode);
        resetPosition();
    }
    return this;
}
 
Example 17
Source File: DupFilterIterator.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Set the start node for this iterator
 * @param node The start node
 * @return A reference to this node iterator
 */
public DTMAxisIterator setStartNode(int node) {
    if (_isRestartable) {
        // KeyIndex iterators are always relative to the root node, so there
        // is never any point in re-reading the iterator (and we SHOULD NOT).
        boolean sourceIsKeyIndex = _source instanceof KeyIndex;

        if (sourceIsKeyIndex
                && _startNode == DTMDefaultBase.ROOTNODE) {
            return this;
        }

        if (node != _startNode) {
            _source.setStartNode(_startNode = node);

            _nodes.clear();
            while ((node = _source.next()) != END) {
                _nodes.add(node);
            }

            // Nodes produced by KeyIndex are known to be in document order.
            // Take advantage of it.
            if (!sourceIsKeyIndex) {
                _nodes.sort();
            }
            _nodesSize = _nodes.cardinality();
            _current = 0;
            _lastNext = END;
            resetPosition();
        }
    }
    return this;
}
 
Example 18
Source File: SAX2DTM2.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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)
  {
    node = makeNodeIdentity(node);

    // iterator is not a clone
    int parent, index;

   if (_type2(node) == DTM.ATTRIBUTE_NODE)
     node = _parent2(node);

    _startNode = node;
    _stack[index = 0] = node;

    parent=node;
    while ((parent = _parent2(parent)) != NULL)
    {
      if (++index == _stack.length)
      {
        final int[] stack = new int[index*2];
        System.arraycopy(_stack, 0, stack, 0, index);
        _stack = stack;
      }
      _stack[index] = parent;
    }

    if(index>0)
      --index; // Pop actual root node (if not start) back off the stack

    _currentNode=_stack[index]; // Last parent before root node

    _oldsp = _sp = index;

    return resetPosition();
  }

  return this;
}
 
Example 19
Source File: SAX2DTM2.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
     * 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 = m_traverser.first(node);

        node = makeNodeIdentity(node);

        int first;
        int type = _type2(node);

        if ((DTM.ATTRIBUTE_NODE == type) || (DTM.NAMESPACE_NODE == type))
        {
          node = _parent2(node);
          first = _firstch2(node);

          if (NULL != first) {
            _currentNode = makeNodeHandle(first);
            return resetPosition();
          }
        }

        do
        {
          first = _nextsib2(node);

          if (NULL == first)
            node = _parent2(node);
        }
        while (NULL == first && NULL != node);

        _currentNode = makeNodeHandle(first);

        // _currentNode precedes possible following(node) nodes
        return resetPosition();
      }

      return this;
    }
 
Example 20
Source File: SAX2DTM2.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
     * 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();
      m_realStartNode = node;

      if (_isRestartable)
      {
        int nodeID = makeNodeIdentity(node);
        m_size = 0;

        if (nodeID == DTM.NULL) {
          _currentNode = DTM.NULL;
          m_ancestorsPos = 0;
          return this;
        }

        // Start from the current node's parent if
        // _includeSelf is false.
        if (!_includeSelf) {
          nodeID = _parent2(nodeID);
          node = makeNodeHandle(nodeID);
        }

        _startNode = node;

        while (nodeID != END) {
          //m_ancestors.addElement(node);
          if (m_size >= m_ancestors.length)
          {
            int[] newAncestors = new int[m_size * 2];
            System.arraycopy(m_ancestors, 0, newAncestors, 0, m_ancestors.length);
            m_ancestors = newAncestors;
          }

          m_ancestors[m_size++] = node;
          nodeID = _parent2(nodeID);
          node = makeNodeHandle(nodeID);
        }

        m_ancestorsPos = m_size - 1;

        _currentNode = (m_ancestorsPos>=0)
                               ? m_ancestors[m_ancestorsPos]
                               : DTM.NULL;

        return resetPosition();
      }

      return this;
    }