Skip to Main Content

DevOps, CI/CD and Automation

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!

Remove attribute from XML

MarwimFeb 14 2013 — edited Feb 15 2013
Hello,

I have to export some xml data into files from our db. Since the xsd has changed it cannot be exported directly onto another db of a third party tool and I have (among other things) to remove an attribute from an element
CREATE TABLE xml_test(
 	message XMLTYPE
 	)
/
INSERT INTO xml_test
VALUES (q'[<?xml version="1.0" encoding="ISO-8859-1"?>
<ZusyMeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://www.zusy.de/2002/XMLSchema" 
xsi:schemaLocation="http://www.zusy.de/2002/XMLSchema ZusyAZ01.xsd">
  <TransferHeader xsi:nil="true"/>
  <Daten>
    A lot more elements
  </Daten>
</ZusyMeldung>/
COMMIT;
<TransferHeader xsi:nil="true"/> should become <TransferHeader/>.

I want to write the files directly with the following script and tried to use updateXML in my SELECT but somehow I don't get it right.
DECLARE
    CURSOR cur_out IS
        SELECT  message
        FROM    xml_test;
BEGIN
    FOR r_out IN cur_out LOOP
        dbms_xslprocessor.clob2file (
             r_out.message
            ,'DIR_XMLOUT'
            ,'out_name.xml'
            ,0
            );
    END LOOP;
END;
/
Regards
Marcus
This post has been answered by odie_63 on Feb 14 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 15 2013
Added on Feb 14 2013
5 comments
3,586 views