Dom4j and xpath problem

D

Denis

Hi all,
I need to select a node from an xml file like this:
<ITEM NAME="A">
<PARAM NAME="xxx" VALUE="yyy"/>
</ITEM>
<ITEM NAME="B">
<PARAM NAME="zzz" VALUE="jjj"/>
<PARAM NAME="IS_VALID" VALUE="TRUE"/>
</ITEM>

I need to select all nodes with existing param named "IS_VALID"

I've then try to use this:
(say node is only one <ITEM> node)
node.selectSingleNode("PARAM/@NAME[.='IS_VALID']")

but node is always null...

I've tryed also with /PARAM and //PARAM but nothing changes!!

What I can do?

Thanks all,
DM
 
J

Jubz

Maybe this will help:
String xpath = "//ITEM[@PARAM='IS_VALID']";
node.selectSingleNode (xpath);
I didn't test this, but something similar should work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top