【发布时间】:2023-03-23 21:00:02
【问题描述】:
当我尝试解析 XML 文档时,XPath 属性出现了一点问题。 这是我的例子:
DECLARE
px_return XMLTYPE
:= XMLTYPE (
'<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<h:AxisValues xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:h="urn:/microsoft/multichannelframework/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:/microsoft/multichannelframework/">
<User xmlns="">FSCD</User>
<Solution xmlns="">Multicare</Solution>
<ApplicationalUser xmlns=""/>
<ApplicationalUserSystem xmlns=""/>
<SystemUser xmlns=""/>
<SystemUserSystem xmlns=""/>
<Proxy xmlns="">0</Proxy>
</h:AxisValues>
</SOAP:Header>
<SOAP:Body xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:maintainMandateResponse xmlns:ns1="urn:enterprise.com/ws/SAP/Finantial/MaintainMandate/V1">
<return>
<messageType>E</messageType>
</return>
</ns1:maintainMandateResponse>
</SOAP:Body>
</soapenv:Envelope>');
lv_msgType VARCHAR2 (20);
BEGIN
SELECT Return.msgType
INTO lv_msgType
FROM XMLTABLE (
xmlnamespaces (
DEFAULT 'enterprise.com/ws/SAP/Finantial/MaintainMandate/V1',
'http://schemas.xmlsoap.org/soap/envelope/' AS "soapenv",
'http://schemas.xmlsoap.org/soap/envelope/' AS "SOAP",
'enterprise.com/ws/SAP/Finantial/MaintainMandate/V1' AS "ns1"),
'//soapenv:Envelope/SOAP:Body/ns1:maintainMandateResponse'
PASSING px_return
COLUMNS msgType VARCHAR2 (1) PATH 'messageType') Return;
DBMS_OUTPUT.put_line ('Message type: ' || lv_msgType);
END;
我收到 NO_DATA_FOUND 异常,因为我在此解析方法中找不到结果。
我尝试了很多不同的策略,包括将return 放入 PATH 或 XQUery 字符串中,但均未成功。
我认为这是一个小而简单的问题,但我找不到。 提前致谢! 菲利普
【问题讨论】:
标签: xml oracle plsql xml-parsing xmltable