下面是 SOAP 服务的响应。我如何在 Pl/SQL 中提取值。我列出了一些我尝试过的方法
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<ShipmentTrackingResponse xmlns="http://ws.aramex.net/ShippingAPI/v1/">
<Transaction xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Reference1>001</Reference1>
<Reference2 i:nil="true"/>
<Reference3 i:nil="true"/>
<Reference4 i:nil="true"/>
<Reference5 i:nil="true"/>
</Transaction>
<Notifications xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/>
<HasErrors>false</HasErrors>
<TrackingResults xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:KeyValueOfstringArrayOfTrackingResultmFAkxlpY>
<a:Key>4738079651</a:Key>
<a:Value>
<TrackingResult>
<WaybillNumber>4738079651</WaybillNumber>
<UpdateCode>SH247</UpdateCode>
<UpdateDescription>Supporting Document Returned to Shipper</UpdateDescription>
<UpdateDateTime>2013-07-15T19:29:00</UpdateDateTime>
<UpdateLocation>Mumbai,India</UpdateLocation>
<Comments/>
<ProblemCode/>
</TrackingResult>
<TrackingResult>
<WaybillNumber>4738079651</WaybillNumber>
<UpdateCode>SH369</UpdateCode>
<UpdateDescription>SMS Sent to Consignee</UpdateDescription>
<UpdateDateTime>2013-07-12T09:10:00</UpdateDateTime>
<UpdateLocation>Mumbai,India</UpdateLocation>
<Comments/>
<ProblemCode/>
</TrackingResult>
<TrackingResult>
<WaybillNumber>4738079651</WaybillNumber>
<UpdateCode>SH033</UpdateCode>
<UpdateDescription>Attempted Delivery - Payment Declined by Customer</UpdateDescription>
<UpdateDateTime>2013-07-11T17:20:00</UpdateDateTime>
<UpdateLocation>Goa Branch-GOI,India</UpdateLocation>
<Comments/>
<ProblemCode>A18</ProblemCode>
</TrackingResult>
<TrackingResult>
<WaybillNumber>4738079651</WaybillNumber>
<UpdateCode>SH369</UpdateCode>
<UpdateDescription>SMS Sent to Consignee</UpdateDescription>
<UpdateDateTime>2013-07-11T10:36:00</UpdateDateTime>
<UpdateLocation>Mumbai,India</UpdateLocation>
<Comments/>
<ProblemCode/>
</TrackingResult>
<TrackingResult>
<WaybillNumber>4738079651</WaybillNumber>
<UpdateCode>SH003</UpdateCode>
<UpdateDescription>Out for Delivery</UpdateDescription>
<UpdateDateTime>2013-07-11T10:19:00</UpdateDateTime>
<UpdateLocation>Goa Branch-GOI,India</UpdateLocation>
<Comments/>
<ProblemCode/>
</TrackingResult>
<TrackingResult>
<WaybillNumber>4738079651</WaybillNumber>
<UpdateCode>SH203</UpdateCode>
<UpdateDescription>Record Created</UpdateDescription>
<UpdateDateTime>2013-07-05T00:39:00</UpdateDateTime>
<UpdateLocation>Nehru Place Branch,India</UpdateLocation>
<Comments/>
<ProblemCode/>
</TrackingResult>
</a:Value>
</a:KeyValueOfstringArrayOfTrackingResultmFAkxlpY>
</TrackingResults>
<NonExistingWaybills xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/></ShipmentTrackingResponse></s:Body>
</s: Envelope>
我如何提取价值,我真的被卡住了,已经尝试了所有方法。一些方法如下:
l_resp_xml := XMLType.createXML(l_clob_response);
SELECT EXTRACT(l_resp_xml, '//ShipmentTrackingResponse/TrackingResults',
'xmlns="http://ws.aramex.net/ShippingAPI/v1/"') INTO l_resp_xml FROM dual;
最后用于提取值:但没用!请帮忙!!
SELECT EXTRACTVALUE(l_resp_xml,
'//TrackingResults/a:KeyValueOfstringArrayOfTrackingResultmFAkxlpY/a:Value/TrackingResult[1]/UpdateDescription', 'xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"')INTO l_response_result FROM dual;
DBMS_OUTPUT.put_line ( 'Result> l_response_clobExtract=' || l_response_result);
如何使用 XmlTable?