[英]exctractvalue from xmltype / soap oracle
我需要从领域获得“无限的”价值
REQUEST_INFO:
...
<s:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<X-dynaTrace xmlns="http://ns.dynatrace.com/wcf" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">FW3;-1003312095;1;-56375709;115092;0;975784079;78</X-dynaTrace>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<storeContract xmlns="xxx/integration">
<storeRequest>
<contract>
<contractSeries>ineedthis</contractSeries>
select extractvalue(XMLType(sap.REQUEST_INFO),'s/s/storeContract/storeRequest/contract/contractSeries')
from sap
无法获得价值
你试图提取路径
s/s/storeContract/storeRequest/contract/contractSeries
但是你的SOAP响应没有任何名为s
节点; 它在命名空间 s
有称为Envelope,Header和Body的节点。 所以你可能想要这条路径:
/s:Envelope/s:Body/storeContract/storeRequest/contract/contractSeries
它自己获取LPX-00601: Invalid token
错误,因为它不知道s:
是什么。 您可以使用第三个参数提供名称空间:
select extractvalue(XMLType(sap.request_info),
'/s:Envelope/s:Body/storeContract/storeRequest/contract/contractSeries',
'xmlns="xxx/integration" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"'
) as contractseries
from sap;
或者懒惰的方式是通配符命名空间,只识别你想要的最终节点:
select extractvalue(XMLType(sap.request_info),'//*:contractSeries') as contractseries
from sap;
但是不推荐使用extractvaue
,因此最好使用XMLQuery - 仍然是懒惰的:
select XMLQuery('//*:contractSeries/text()'
passing XMLType(sap.request_info)
returning content) as contractseries
from sap;
或使用显式名称空间:
select XMLQuery('
declare default element namespace "xxx/integration";
declare namespace s="http://schemas.xmlsoap.org/soap/envelope/";
/s:Envelope/s:Body/storeContract/storeRequest/contract/contractSeries/text()'
passing XMLType(sap.request_info)
returning content) as contractseries
from sap;
CONTRACTSERIES
------------------------------
ineedthis
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.