public Batch buildBatch(File batchFile) throws IOException, ParserConfigurationException, SAXException, ProcessException { Batch batch = Batch.getInstance(); FileInputStream fis = new FileInputStream(batchFile); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fis); Element pnode = doc.getDocumentElement(); NodeList nodes = pnode.getChildNodes(); for (int idx = 0; idx < nodes.getLength(); idx++) { Node node = nodes.item(idx); if (node.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element) node; Command parsedCommand = this.buildCommand(elem); batch.addCommand(parsedCommand); System.out.println("Command parsing"); } } return batch; }