[jdom-interest] Xpath element returning NULL

Laurent Bihanic laurent.bihanic at atosorigin.com
Wed Jun 22 01:40:37 PDT 2005

Anand, Rajesh wrote:
> I'm trying to locate this element, code snippet…
> * Element element1 = (Element) XPath.selectSingleNode(pf.doc, 
> "SOAP-ENV:Envelope/SOAP-ENV:Body/getIndex:IndexServiceRequest/getIndex:EndDate");*

You need to register the namespaces to the XPath :

XPath xpath = new 
xpath.addNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/");

Element element1 = (Element) xpath.selectSingleNode(pf.doc);


                 (o o)
Laurent Bihanic                | Tel: +33 (0)1 (direct)
AtosOrigin Systems Integration |      +33 (0)1
Generic Solutions / SC         | Fax: +33 (0)1
Les Miroirs - Bat. C           |
18, avenue d'Alsace            |
F-92926 La Defense Cedex       | E-mail: laurent.bihanic at atosorigin.com

Very funny, Scotty. Now beam down my clothes.

The opinions expressed are entirely my own and may not necessarily be
those of my employer.  Also, I am not now nor have I ever been a
lawyer.  My opinions are provided as-is with absolutely no warrantee of
merchantability or fitness for any particular use.  Besides, you can't
prove I typed this.  No body saw me type this.  Who says I typed this?

More information about the jdom-interest mailing list