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!

how to create xml document from xml table

ateeqrahmanOct 26 2021 — edited Oct 26 2021

Hi,
i am using oracle 11.2.0.4 on windows 2016 64 bit.
I have a table with invoice number and an xmltype column to store xml data. I would like to create a xml document with invoice_number.xml in a directory.
I tried using below methods but they create additional tags at the beginning of xml document.
DECLARE
rc sys_refcursor;
BEGIN
OPEN rc FOR SELECT invoice_xml FROM invoice_xml_info where invoice_number='571306';
dbms_xslprocessor.clob2file( xmltype( rc ).getclobval( ) , 'XT_DIR','clob2file.xml');
END;
Output is as below
<?xml version="1.0"?>
<ROWSET>
<ROW>
<INVOICE_XML>
<Invoice xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
<cbc:ID>571306</cbc:ID>
.......
I dont want the first 3 tags (need xml version) to appear in my xml document. Please advice.

This post has been answered by ateeqrahman on Oct 26 2021
Jump to Answer
Comments
Post Details
Added on Oct 26 2021
1 comment
60 views