[jdom-interest] Can't get values using xpath

John Hurst jbhurst at attglobal.net
Fri Oct 24 18:59:38 PDT 2003


Hi,

The problem seems to be in the way you are dealing with namespaces.

I got your code to work in two different ways:

1) Remove the namespace declarations from the XML string.

2) Modify the XML document, and the XPath expression, to put a namespace
prefix in, e.g.:

	<x:APIInterface
xmlns:x='http://nc3pc4.sch.advantis.com/XMLSchema/API'	...
	</x:APIInterface>

...

      String RET = getProperty(pvcDocA,
        "/x:APIInterface/StoreSiteResponse/ReturnCode");

BTW, the code you posted doesn't compile -- you have 

	public static String oneXml = ...

but in main() you name the field testXml.

Regards

John Hurst

-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org] On
Behalf Of Abhijeet Sarwate
Sent: Saturday, 25 October 2003 05:41
To: jdom-interest at jdom.org
Subject: [jdom-interest] Can't get values using xpath

Folks

I use Jaxen's XPath engine to  get data out of xml

here is the xml that I use

<?xml version='1.0' encoding='ISO-8859-1'?>
    <APIInterface xmlns='http://nc3pc4.sch.advantis.com/XMLSchema/API' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'        
xsi:schemaLocation='http://nc3pc4.sch.advantis.com/XMLSchema/API 
./NC3API.xsd'>
    <StoreSiteResponse>
        <ReturnCode>00000000</ReturnCode>
        <NC3Key>22741892</NC3Key>
    </StoreSiteResponse>
</APIInterface>";


.
.
.

Thanks

abhijeet sarwate

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list