Hello,
your XPath expression is test which returns boolean value – so result
is java.lang.Boolean. Your expression tests if there is some element
foo:Time which inner text is equal to enganged time. In case you want
select element, which contains this time, you have to use another
XPath expression:

//foo:Time/[text()=your_time]

Sincerely,

Filip Jirsák


2009/4/23 Patrick Renard <patrick_ren...@hotmail.com>:
> Hello,
>
> I am in trouble with selectSingleNode !
>
> I use the following code:
>
>                         XPath Time_XPath = DocumentHelper.createXPath(
> "//foo:Time/text()='" + HRM_DateTime_Seq_String + "'");
>                         HashMap<String,String> Time_map = new
> HashMap<String,String>();
>
> Time_map.put("foo",TrainingCenterDatabase.getNamespaceURI());
>                         Time_XPath.setNamespaceURIs(map);
>
>                         if
> (Time_XPath.booleanValueOf(TrainingCenterDatabase))
>                             {
>                                 System.out.println(HRM_DateTime_Seq_String +
> ": Match");
>                                 Node node =
> Time_XPath.selectSingleNode(TrainingCenterDatabase);           <== problem
>                             }
>                             else
>                             {
>                                 System.out.println(HRM_DateTime_Seq_String +
> ": No Match");
>                             }
>
> An I get:
>
> XPath expression is not a Node. It was: true of type: java.lang.Boolean
>         at
> org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:169)
>         at Merge_TCX_to_HRM.main(Merge_TCX_to_HRM.java:147)
>
>
> selectSingleNode does not return a Node but True Or False !
>
> I do not understand... Could you help me ?
>
> Sincerely.
>
> Patrick Renard
>
> ________________________________
> Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ?
> Lancez-vous !
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> dom4j-user mailing list
> dom4j-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
>
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to