Hi Jeff,
selectNodes(String) is one of the methods inherited from interface
org.dom4j.Node (see http://www.dom4j.org/apidocs/org/dom4j/Element.html)
The error is not the use of the method because it runs which any XPath
expression, in fact the same XPath expression runs right if the text
searched is the first child of the node in the XML tree. The problem is that
selectNodes doesn't found the text if it is in any position different from
the first.
Adriana
_____
De: Jeffrey F. Elrod [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 08 de mayo de 2008 18:50
Para: Adriana Verdejo
Asunto: Re: [dom4j-user] Problem using xPath expression
Looks like you should have got a syntax error. Looking at the Javadoc, I
didn't see a selectNodes(String) method for type Element.
Jeff
----- Original Message ----
From: Adriana Verdejo <[EMAIL PROTECTED]>
To: dom4j-user@lists.sourceforge.net
Sent: Thursday, May 8, 2008 7:45:12 AM
Subject: [dom4j-user] Problem using xPath expression
Dear all,
I am very confused because I use this XPath expression:
"info[(contains(identification-info/keyword,"Cities"))]" in order to
retrieve the below node and it runs ok, but if I use the XPath expression:
"info[(contains(identification-info/keyword,"North"))]" doesn't run.
My xml is:
<root>
...
<info>
<identification-info>
<name>Name 1</name>
<keyword>Cities of Europe</keyword>
<keyword>North Europe</keyword>
....
</identification-info>
</info>
...
</root>
I mean when I am looking for a "info" whose "keyword" is not its first child
I don't retrieve the node. Why????
I am using dom4j-1.6.1 and my code is:
String xPath = "info[(contains(identification-info/keyword,"Europe"))]"
List<Node> listNodes = myXML.getRootElement().selectNodes(xPath);
where myXML is the Document wich contains the XML.
When I run that, listNodes is empty. Is necessary any parameter in order to
selectNodes search in every child and not only in the first?
Thanks in advance and regards,
Adriana
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user