Hello Martin, I think this should work. Following code Document document = DocumentHelper.parseText("<node1><node2>Text in node2.</node2></node1>"); Node node = document.selectSingleNode("//node1/node2/text()"); System.out.println(node.getNodeTypeName()); System.out.println(node.getText());
prints following two lines for me: Text Text in node2. Sincerely, Filip Jirsák 2009/2/4 Martin Palma <mar...@palma.bz>: > Hello, > I have some question to how to use XPath with dom4j. The problem I > face is that in my java application the User can enter a XPath > expression and query a dom4j xml document object and get back the > result. > For simple XPath expression like: "//node1/node2", "//nod...@att=1]" > it works perfectly. But when I write let's say the following XPath > expression "//node1/node2/text()" it doesn't. > My question is can I query a dom4j xml document object with such expression? > > Bye, > Martin > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills and code to > build responsive, highly engaging applications that combine the power of local > resources and data with the reach of the web. Download the Adobe AIR SDK and > Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com > _______________________________________________ > dom4j-user mailing list > dom4j-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dom4j-user > -- Filip Jirsák fi...@jirsak.org ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user