Hello everyone! Would you do me a favor?
I have a XML string:
<!-- begin -->
<?xml version="1.0" encoding="UTF-8"?>
<serviceRoot xmlns=" http://B2Bi.seaie.ccb.com/InTxB2Bi002" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance ">
<serviceName>TelecomService</serviceName>
<servicePort>TelecomService</servicePort>
<serviceMethod>cxCharge</serviceMethod>
<appKey>123</appKey>
<serviceRoot xmlns=" http://B2Bi.seaie.ccb.com/InTxB2Bi002" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance ">
<serviceName>TelecomService</serviceName>
<servicePort>TelecomService</servicePort>
<serviceMethod>cxCharge</serviceMethod>
<appKey>123</appKey>
</serviceRoot>
<!-- end -->
// I want to read the text of <serviceMethod> with valueOf(String xpathExpression) method:
String s = document.valueOf("//serviceRoot/serviceMethod");
// The "s" shuld be "cxCharge", but it is "".
I found the "xmlns" is the cause of it. If I set xmlns to "" or delete it, I will get string I expected.
The xmlns always exsits and can't modify. How can I get expected string in this case?
Thank you very much!! :-)
Lei YuPing