コード例 #1
0
  public boolean nextNode() {
    super.setPosition(getCurrentPosition() + 1);
    if (!setStarted) {
      setStarted = true;
      if (!(nodeTest instanceof NodeNameTest)) {
        return false;
      }

      NodeNameTest nodeNameTest = (NodeNameTest) nodeTest;
      QName testName = nodeNameTest.getNodeName();
      if (testName.getPrefix() != null) {
        return false;
      }
      if (nodeNameTest.isWildcard()) {
        iterator = parentContext.getCurrentNodePointer().namespaceIterator();
      } else {
        currentNodePointer =
            parentContext.getCurrentNodePointer().namespacePointer(testName.getName());
        return currentNodePointer != null;
      }
    }

    if (iterator == null) {
      return false;
    }
    if (!iterator.setPosition(iterator.getPosition() + 1)) {
      return false;
    }
    currentNodePointer = iterator.getNodePointer();
    return true;
  }
コード例 #2
0
 public void reset() {
   setStarted = false;
   iterator = null;
   super.reset();
 }