Forum Stats

  • 3,768,544 Users
  • 2,252,807 Discussions
  • 7,874,616 Comments

Discussions

how to create xml document from xml table

ateeqrahman
ateeqrahman Member Posts: 254 Bronze Badge
edited Oct 26, 2021 7:32AM in General XML

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.

Best Answer

Answers