XML parsing in oracle pl/sql

前端 未结 2 1848
自闭症患者
自闭症患者 2021-01-28 14:06

I am trying to parse this XML in PL/SQL


 


        
2条回答
  •  鱼传尺愫
    2021-01-28 14:32

    I think there are two things you have wrong here:

    • Firstly, your XPath expression //@GovernmentCode/ is wrong. It should not have a trailing /, and you don't want the @ either because GovernmentCode is an element, not an attribute.

    • Secondly, you must specify the XML namespace declaration in your call to EXTRACTVALUE as well as in your call to EXTRACT.

    Making these changes leaves you with the following code. I gave it a quick test, and it seemed to work:

    SELECT EXTRACTVALUE (VALUE (xml_list), '//GovernmentCode', 'xmlns="http://www.irs.gov/efile"') AS SysID
      INTO lv_transid      
      FROM TABLE (
                XMLSEQUENCE (
                   EXTRACT (in_xmlclob, '/AckTransmission/Acknowledgement',
                            'xmlns="http://www.irs.gov/efile"'))) xml_list;   
    

提交回复
热议问题