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
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
Your prefixes don't correspond to those defined in the document header - they must
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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");
ASKER
crazy thing that I did not notice the missing namespace. Thank you for spotting that. After the fix it worked.
:-)