Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

parse XMLTable with multiple namespaces

LemarJan 10 2023

Hello,
I want to parse a xml send as web service response, it looks like this
with sample_data as (
select xmltype('<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<m:ListOfCountryNamesByNameResponse xmlns:m="http://www.oorsprong.org/websamples.countryinfo">
<m:ListOfCountryNamesByNameResult>
<m:tCountryCodeAndName>
<m:sISOCode>AX</m:sISOCode>
<m:sName>cland Islands</m:sName>
</m:tCountryCodeAndName>
</m:ListOfCountryNamesByNameResult>
</m:ListOfCountryNamesByNameResponse>
</soap:Body>
</soap:Envelope>') xml
from dual)

select x.sName from sample_data t, xmltable(
xmlnamespaces(
default 'http://www.oorsprong.org/websamples.countryinfo/',
'http://schemas.xmlsoap.org/soap/envelope' as "soap",
'http://www.oorsprong.org/websamples.countryinfo' as "m"),
'/soap:Envelope/soap:Body/ListOfCountryNamesByNameResponse/m:ListOfCountryNamesByNameResult/m:tCountryCodeAndName' passing
t.xml columns
sName varchar2(100) path './m:sName')
x;
but never get any rows selected.
can anyone help me to solve this problem?
Thanks
Marco

This post has been answered by Jason_(A_Non) on Jan 10 2023
Jump to Answer

Comments

Processing

Post Details

Added on Jan 10 2023
2 comments
1,152 views