Error in XMLTYPE in xml with namespaces

1

The following sql statement is causing me an error LPX-00601: Invalid token in: '/ soap: Envelope / soap: Body / GetRatesTreeResponse'. Could you tell me if you see any failure?

WITH mydata AS
   (SELECT TO_CLOB('<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                       <soap:Body>
                          <GetRatesTreeResponse xmlns="http://orca.orangetech.es/Tazzyv30/Tazzy/RateService">
                             <GetRatesTreeResult>
                                <RateNode>
                                   <Id>686</Id>
                                   <HotelCode>TEST</HotelCode>
                                   <HotelName>Loading Test</HotelName>
                                   <RateCode>BASE</RateCode>
                                   <RateName>BASE</RateName>
                                   <GroupRateCode>MEUSA</GroupRateCode>
                                   <GroupRateName>MERCADO ESTADOUNIDENSE</GroupRateName>
                                   <CalcType>PrecioNeto</CalcType>
                                   <CurrencyCode>US</CurrencyCode>
                                   <CurrencyName>USA</CurrencyName>
                                   <ParentRateId xsi:nil="true"/>
                                </RateNode>
                                <RateNode>
                                   <Id>687</Id>
                                   <HotelCode>TEST</HotelCode>
                                   <HotelName>Loading Test</HotelName>
                                   <RateCode>OTA</RateCode>
                                   <RateName>OTA</RateName>
                                   <GroupRateCode>MEUSA</GroupRateCode>
                                   <GroupRateName>MERCADO ESTADOUNIDENSE</GroupRateName>
                                   <CalcType>PrecioNeto</CalcType>
                                   <CurrencyCode>US</CurrencyCode>
                                   <CurrencyName>USA</CurrencyName>
                                   <ParentRateId>686</ParentRateId>
                                </RateNode>
                                <RateNode>
                                   <Id>688</Id>
                                   <HotelCode>TEST</HotelCode>
                                   <HotelName>Loading Test</HotelName>
                                   <RateCode>WEB</RateCode>
                                   <RateName>WEB</RateName>
                                   <GroupRateCode>MEUSA</GroupRateCode>
                                   <GroupRateName>MERCADO ESTADOUNIDENSE</GroupRateName>
                                   <CalcType>PrecioNeto</CalcType>
                                   <CurrencyCode>US</CurrencyCode>
                                   <CurrencyName>USA</CurrencyName>
                                   <ParentRateId>686</ParentRateId>
                                </RateNode>
                             </GetRatesTreeResult>
                          </GetRatesTreeResponse>
                       </soap:Body>
                    </soap:Envelope>') c
    FROM   DUAL) 
SELECT EXISTSNODE(xmltype(c), '/soap:Envelope/soap:Body/GetRatesTreeResponse') 
FROM mydata t;
    
asked by Josep Miquel Flexas 10.05.2016 в 12:35
source

1 answer

0

In your case, you need to specify the third parameter namespace_string of the function existsnode to work correctly:

SELECT EXISTSNODE(
         xmltype(c), 
         '/soap:Envelope/soap:Body/GetRatesTreeResponse',
         'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://orca.orangetech.es/Tazzyv30/Tazzy/RateService"') 
FROM mydata t;
    
answered by 08.11.2016 в 04:33