public void traverseFragment(Node pos) throws org.xml.sax.SAXException {
  Node top=pos;
  while (null != pos) {
    startNode(pos);
    Node nextNode=pos.getFirstChild();
    while (null == nextNode) {
      endNode(pos);
      if (top.equals(pos))       break;
      nextNode=pos.getNextSibling();
      if (null == nextNode) {
        pos=pos.getParentNode();
        if ((null == pos) || (top.equals(pos))) {
          if (null != pos)           endNode(pos);
          nextNode=null;
          break;
        }
      }
    }
    pos=nextNode;
  }
}

public void traverseFragment ( Node pos ) throws org . xml . sax . SAXException { Node top = pos ; while ( null != pos ) { startNode ( pos ) ; Node nextNode = pos . getFirstChild ( ) ; while ( null == nextNode ) { endNode ( pos ) ; if ( top . equals ( pos ) ) break ; nextNode = pos . getNextSibling ( ) ; if ( null == nextNode ) { pos = pos . getParentNode ( ) ; if ( ( null == pos ) || ( top . equals ( pos ) ) ) { if ( null != pos ) endNode ( pos ) ; nextNode = null ; break ; } } } pos = nextNode ; } }
perform a pre - order traversal non - recursive style . in contrast to the traverse ( ) method this method will not issue startdocument ( ) and enddocument ( ) events to the sax listener .
