Thanks Bertrand. I see where this could return a list of strings. In my case, all of the functions were taking place within predicates, so I was expecting that only the refinement of the node list would be returned as a list of nodes, which I think is what you are saying and is the correct interpretation.
steve -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bertrand Mollinier Toublet Sent: Friday, May 07, 2004 2:49 PM To: [EMAIL PROTECTED] Subject: Re: [dom4j-user] selectNodes(xpathExpression) question Stephen C. Upton wrote: > In the javadocs, the Node method, selectNodes, says this: > > 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? > 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. 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 ------------------------------------------------------- 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