我正在尝试使用FaultMessage
从XML响应中解析EXTRACTVALUE
。下面是我的SQL代码:
SELECT EXTRACTVALUE( XMLTYPE('
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring xml:lang="tr-TR">İstek şeması doğrulanamadı. Lütfen tüm bilgileri kontrol edin.</faultstring>
<detail>
<Fault xmlns="http://schemas.datacontract.org/2004/07/CustomServiceLibrary.DataContract" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<FaultCode>Schema_Customer_005|1e8c66-c333-4357-9c7d-3f4fcd553</FaultCode>
<FaulCategory>Schema</FaulCategory>
<FaultMessage> Customer name can not be blank, can not contain spaces, or any special characters. LASTNAMEFIRSTNAME is the required format. </FaultMessage>
<FaultDetailedMessage>UMUT DEMIRCI</FaultDetailedMessage>
</Fault>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>'),
'/s:Envelope/s:Body/s:Fault/detail/*:Fault/FaultMessage',
'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://schemas.datacontract.org/2004/07/CustomServiceLibrary.DataContract" ') a
FROM DUAL
请建议我如何获得FaultMessage
。
答案 0 :(得分:2)
给出:
Fault
元素 及其后代 位于http://schemas.datacontract.org/2004/07/CustomServiceLibrary.DataContract
命名空间中。a
定义了http://schemas.datacontract.org/2004/07/CustomServiceLibrary.DataContract
命名空间前缀*
作为名称空间前缀的通配符需要XPath 2.0 +。更改
/s:Envelope/s:Body/s:Fault/detail/*:Fault/FaultMessage
至
/s:Envelope/s:Body/s:Fault/detail/a:Fault/a:FaultMessage
,以便您的XPath正确且不需要XPath 2.0+处理器。