Document document = null; document = DocumentHelper.parseText(xml); Element root = document.getRootElement(); Element nodeItems = (Element)root.selectSingleNode("//nodes/node[@itemNumber=\""Num+"\"]"); ...