public static List getChildrenByTagName() throws XPathExpressionException, ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse("Input.xml"); XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); xpath.setNamespaceContext(new wdXMLNamespaceResolver(doc, false)); //XPathExpression xPathQuery = xpath.compile(query); Node links = (Node)xpath.evaluate("/userdata/David/tester[@id='1000']", doc, XPathConstants.NODE); List nodeList = new ArrayList(); for (Node child = links.getFirstChild(); child != null; child = child.getNextSibling()) { if ...