selenium Two

Greenhorn
+ Follow
since Aug 09, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by selenium Two

Here's the snipet. Every time it goes into the loop the elements are read but not added and there value is always null

public static List<Element> 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<Element> nodeList = new ArrayList<Element>();
for (Node child = links.getFirstChild(); child != null; child = child.getNextSibling()) {
if (child.getNodeType() == Node.ELEMENT_NODE ) {
nodeList.add((Element) child);


}


Please help .. In a new role


}
// System.out.println(nodeList.toString()); //Testing
return nodeList;

}
14 years ago