Hi !

I'am a beginer in dom4j. I searched if some one else have the same problem and I did not found.

My environment :
sun jdk1.5.0_06
dom4j-1.6.1
fedora core 4

My xml file :

<?xml version="1.0" encoding="ISO-8859-1"?>
<CONNECTIONS-CONFIGURATION>
   <CONNECTION name="defaultDWH"
                   isDefault="true"
                   isJNDI="true"
                   initialContext="java:comp/env"
                   resourceName="jdbc/sbifoodmart"/>
<CONNECTION name="postgresDWH" isDefault="false" isJNDI="false" driver="org.postgresql.Driver"
                   user="foodmart"
                   password="smartfood"
                   jdbcUrl="jdbc:postgresql://localhost:5432/foodmart"/>
</CONNECTIONS-CONFIGURATION>

I have to determine the good connection I must use. If no connction is define I use the default one : isDefault="true". But when I indicate the name of the connection that I want to use dom4J not found any one. I identtify that my problem comes from this code :

  if(nameConnection!=null) {
connectionDef = documentConFile.selectSingleNode("//CONNECTIONS-CONFIGURATION/[EMAIL PROTECTED]'"+ nameConnection +"']");
   } else {
connectionDef = documentConFile.selectSingleNode("//CONNECTIONS-CONFIGURATION/[EMAIL PROTECTED]'true'");
   }

The variable "nameConnection" is valid. I check it and it is intanciated and is the good value. If I put a static text like "//CONNECTIONS-CONFIGURATION/[EMAIL PROTECTED]'postgresDWH']" for the Xpath, dom4j return a valid "connectionDef". If I put this same string in a variable dom4j selectSingleNode method return null.

Xpath parameter of selectSingleNode method can't be a variable ?

Thanks a lot.

Charly CLAIRMONT
----------------
CTO
ALTIC, une ALTernative à votre système d'Information et de Communication
mail : [EMAIL PROTECTED]
mob  : +33(0)661736013
tel  : +33(0)870286663
site : www.altic.org







-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to