Parsing XML with unknown namespaces in Oracle SQL

前端 未结 1 1422
旧时难觅i
旧时难觅i 2021-02-06 07:58

I\'m having trouble with Oracle SQL and XMLs.

I\'ll be getting loads of clobs of well-formed XML data from an external system to parse, interpret and fill some tables wi

1条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 08:16

    I know this is pretty old, but I spotted it today and remembered the pain I experienced trying to deal with namespaced XML. My solution was to strip out the namespaces with an XSLT transform and process it as plain old XML. The function I used to do this is:

    function remove_namespace( i_xml in xmltype )
      return xmltype
    is
      v_xml xmltype default i_xml;
      v_xsl varchar2(32767);
    begin
      v_xsl := '
            
            
            
              
              
              
              
                
                
                
                  
                    
                  
                
              
             
             
             
             ';
      return v_xml.transform(xmltype(v_xsl));
    end;
    

    0 讨论(0)
提交回复
热议问题