1

请帮我在“ <web:prop value='013b92124ce54924' name='serviceId'></web:prop>”中获得价值(013b92124ce54924)

我尝试使用 xpath 命令不成功:

/*/SOAP-ENV:Body/'ns':requestResponse/web:webapiResponse/web:data/web:prop[@name='serviceId']/@value

我的 SOAP 响应如下:

`

 <?xml version="1.0" encoding="utf-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body>

    <ns:requestResponse xmlns:ns='http://www.phahahotel.com/BPS/sWebAPI'>

        <web:webapiResponse xmlns:web='http://www.phahahotel.com/BPS/WebService' action='CreateServiceTel' transId='10100000009' clientId='svrcore'>

            <web:respCode>0000</web:respCode>

            <web:respDescription>Success</web:respDescription>

            <web:data>

                <web:prop value='SERTYPE' name='serviceType'></web:prop>

                <web:prop value='013b92124ce54924' name='serviceId'></web:prop>

            </web:data>

        </web:webapiResponse>

    </ns:requestResponse>  

</SOAP-ENV:Body>

`

谢谢,

4

1 回答 1

0

删除 ns 周围的引号:-

% xpath test.xml "/*/SOAP-ENV:Body/ns:requestResponse/web:webapiResponse/web:data/web:prop[@name='serviceId']/@value"
Found 1 nodes:
-- NODE --
 value="013b92124ce54924"
于 2012-12-13T08:26:14.043 回答