In the javadocs, the Node method, selectNodes, says this:You might want to check the XPath spec at http://www.w3.org/TR/xpath. XPath defines functions that return strings (such as name() or local-name()). These functions can be called in predicates (in which case they are only going to hepl refine the selection of nodes, or outside predicates, where they might have the XPath expression return a value of string type.
public List selectNodes(String xpathExpression)
selectNodes evaluates an XPath expression and returns the result as a List of Node instances or String instances depending on the XPath expression.
What is the discerning factor on whether a list of Nodes or Strings gets returned? I couldn't easily find anything in the xml spec stating what the difference was. In my application, I have a xpathExpression that would select a single node, or using predicates, select a list. Also, would this method every return the empty list for other than an xpathExpression that didn't match any nodes in the document?
E.g.:
//*[local-names()='foo'] selects all the nodes whose local name (i.e. regardless of namespace) is foo. string(//*[local-names()='foo']) returns the string representation of said nodes.
-- Bertrand Mollinier Toublet Lead developer. Software alchemist. Gold maker. nexB - http://www.nexb.com
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user