Hello, I'm quite new to Xalan and Xpath, and I have a problem extracting a node text from an XML document. I'm trying to extract the text node of CheckCustomerPINResult in the following document:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <CheckCustomerPINResponse xmlns="http://www.SigValue.com/SVCrm"> <CheckCustomerPINResult>xyz</CheckCustomerPINResult> <ErrCode>1234</ErrCode> </CheckCustomerPINResponse> </soap:Body> </soap:Envelope> I'm trying the following test using the supplied example: SimpleXPathAPI.exe d:\response.xml / /soap:Envelope/soap:Body/CheckCustomerPINResponse/CheckCustomerPINResult /text() But I get no output. I noticed that if I remove the default namespace from CheckCustomerPINResponse or even if I use a prefix like <CheckCustomerPINResponse xmlns:myprefix="http://www.SigValue.com/SVCrm"> then I do get the right value 'xyz'. I tried reading the mailing lists and searched the internet, but still didn't find a way to extract the text() when the default namespace exist. The only suggested solutions are changing the document to have a prefix. This is something I cannot do, because the document is not generated by me. It is a response from a soap server. Another thing I don't understand: why should I use the 'soap' prefix at all? For as much as I know the prefix is arbitrary and what really important is the URI. Therefore, I expected that the following expression (assuming I remove the default namespace) would work too, but it doesn't. /Envelope[namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']/B ody[namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']/CheckCu stomerPINResponse/CheckCustomerPINResult/text() Isn't this expression equivalent to the first one I wrote above? Thank you, Ori Doolman, Sigvalue Technologies.