我有一个类似下面的SOAP请求
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.revenue.ie/ras/webservices">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">BWyAGdlqp5ZuySEwHUfniA==</wsse:Nonce>
<wsu:Created>2014-07-24T09:43:16.665Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<thisNodeChanges>
<string xsi:type="xsd:string">DATAHERE</string>
</thisNodeChanges>
</soapenv:Body>
</soapenv:Envelope>
如果“thisNodeChanges”从请求变为请求,那么如何使用xpath获取文本值“DATAHERE”,“string”也是如此。
如果我做//string/text()
它有效但它并不总是被称为字符串。
由于
答案 0 :(得分:0)
我认为这可行:
'//*[name()="soapenv:Body"]/*/*/text()'