Charly,

it should work, are you sure that the variable 'nameConnection' has the value "postgresDWH" (without the quotes)?

also, I've noticed that you don't have a closing ']' in the xpath _expression in your else-clause.

regards,
Maarten

Charly CLAIRMONT <[EMAIL PROTECTED]> wrote:
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 :




isDefault="true"
isJNDI="true"
initialContext="java:comp/env"
resourceName="jdbc/sbifoodmart"/>

isDefault="false"
isJNDI="false"
driver="org.postgresql.Driver"
user="foodmart"
password="smartfood"
jdbcUrl="jdbc:postgresql://localhost:5432/foodmart"/>


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
an d 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


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.

Reply via email to