private void processNextFile(){
  if (fileIterator.hasNext()) {
    currentFileResource=fileIterator.next();
    File currentFile=currentFileResource.getFile();
    FileInputStream inputStream=null;
    NodeList nodeList=null;
    try {
      inputStream=new FileInputStream(currentFile);
      InputSource inputSource=new InputSource(inputStream);
      nodeList=(NodeList)compiledRootXPath.evaluate(inputSource,XPathConstants.NODESET);
    }
 catch (    FileNotFoundException e) {
      new RuntimeException(e);
    }
catch (    XPathExpressionException e) {
      new RuntimeException(e);
    }
 finally {
      IOUtils.closeQuietly(inputStream);
    }
    if (nodeList != null) {
      for (int i=0; i < nodeList.getLength(); i++) {
        nodes.add(nodeList.item(i));
      }
    }
  }
}

private void processNextFile ( ) { if ( fileIterator . hasNext ( ) ) { currentFileResource = fileIterator . next ( ) ; File currentFile = currentFileResource . getFile ( ) ; FileInputStream inputStream = null ; NodeList nodeList = null ; try { inputStream = new FileInputStream ( currentFile ) ; InputSource inputSource = new InputSource ( inputStream ) ; nodeList = ( NodeList ) compiledRootXPath . evaluate ( inputSource , XPathConstants . NODESET ) ; } catch ( FileNotFoundException e ) { new RuntimeException ( e ) ; } catch ( XPathExpressionException e ) { new RuntimeException ( e ) ; } finally { IOUtils . closeQuietly ( inputStream ) ; } if ( nodeList != null ) { for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { nodes . add ( nodeList . item ( i ) ) ; } } } }
read in next file and store the nodes which satisfy the given xpath expression in the queue for further process .
