Link to home
Create AccountLog in
Avatar of pattabi23in
pattabi23in

asked on

XPATH with Namespace using Dom4j

Hi,
I am using dom4j api and trying to evaluate an xpath. It is not working for me when the xml uses namespaces. Could you please let me know what changes should I make?
dom4j version: 1.6




ee-ques.txt
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Your prefixes don't correspond to those defined in the document header - they must
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
After fixing that your session id is returnable (my JDOM works) with the expression below:
 org.jdom.xpath.XPath xpath = org.jdom.xpath.XPath.newInstance("//soap:Header/snp:m_Header/snp:m_SessionID");

Open in new window

Avatar of pattabi23in
pattabi23in

ASKER

crazy thing that I did not notice the missing namespace. Thank you for spotting that. After the fix it worked.
:-)