Forum Stats

  • 3,826,846 Users
  • 2,260,713 Discussions
  • 7,897,098 Comments

Discussions

How to parse the value from xmlns?

User_8849S
User_8849S Member Posts: 7 Green Ribbon

Hi Guys,

I'm trying the parse the report content value from the below xml, but it's returning Null.

Could you please help me on this??

Query:

SELECT APEX_WEB_SERVICE.PARSE_XML (

P_XML => XMLTYPE(:VAL),

P_XPATH => '//reportBytes/text()',      

P_NS => 'xmlns:ns2="http://xmlns.oracle.com/oxp/service/PublicReportService"'

) VAL FROM DUAL

Xml:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

 <env:Header/>

 <env:Body>

    <ns2:runReportResponse xmlns:ns2="http://xmlns.oracle.com/oxp/service/PublicReportService">

   <ns2:runReportReturn>

    <ns2:reportBytes>output</ns2:reportBytes>

    <ns2:reportContentType>text/xml</ns2:reportContentType>

        <ns2:reportFileID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>

        <ns2:reportLocale xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>

        <ns2:metaDataList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>

   </ns2:runReportReturn>

  </ns2:runReportResponse>

 </env:Body>

</env:Envelope>

Tagged:

Best Answer

  • cormaco
    cormaco Member Posts: 1,943 Silver Crown
    Answer ✓

    You almost got it, the XPAth must look like this:  '//ns2:reportBytes/text()'

    SELECT APEX_WEB_SERVICE.PARSE_XML (
        P_XML => XMLTYPE(:VAL),
        P_XPATH => '//ns2:reportBytes/text()',      
        P_NS => 'xmlns:ns2="http://xmlns.oracle.com/oxp/service/PublicReportService"'
    ) VAL FROM DUAL
    
    VAL
    ---------------------
    output
    

Answers