Question

XML Header Line in PLSQL

  • 19 December 2022
  • 7 replies
  • 138 views

Userlevel 1
Badge +5

Hi ,

I have created one out bound XML file but i am unable to add XMl version as First Line from Plsql .

Can any one suggest how we can do this from PLSQL code.

This is my example.

  
      Xml_Record_Writer_SYS.Start_Element(xml_, 'Documents',
                                            'xmlns', 'axxos.com/AXIOrderV4',
                                            'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance',
                                            'xsi:schemaLocation','axxos.com/AXIOrderV4 file:///Z:/10_PDT_DownTime/Import%20Export/AXI%20std%20Import/AXIOrderStandardV4.71.xsd');

        Xml_Record_Writer_SYS.Add_Element(xml_,'UniqueId','||>?xml version="1.0" encoding="UTF-8" ?<',NULL,NULL);
--

Expected output is 

 

 


7 replies

Userlevel 7
Badge +22

Hi @Amar1479 

did you check the transformer in IFS Connect of this xml file? 

Userlevel 1
Badge +5

Hi @Link 
i am not using any Transformers for this.

Userlevel 7
Badge +22

What kind fo xml file is this and where did you create it?

Userlevel 1
Badge +5

I am using this to generating the XML from  PLSQLAP_Server_API.Post_Outbound_BizAPI 

 

 DBMS_LOB.createtemporary(xml_, TRUE);
      Xml_Text_Writer_API.Init_Write_Buffer;
      
      
      Xml_Record_Writer_SYS.Start_Element(xml_, 'Documents',
                                            'xmlns', 'axxos.com/AXIOrderV4',
                                            'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance',
                                            'xsi:schemaLocation','axxos.com/AXIOrderV4 file:///Z:/10_PDT_DownTime/Import%20Export/AXI%20std%20Import/AXIOrderStandardV4.71.xsd');
      
--      Xml_Record_Writer_SYS.Add_Element(xml_,'UniqueId',sys_GUID(),NULL,NULL);
       --Xml_Record_Writer_SYS.Add_Element(xml_,'',' &gt?xml version=''"1.0"' ,NULL,NULL);
       -- Xml_Record_Writer_SYS.Add_Element(xml_,'SchemaVersion',4.71,NULL,NULL);
           -- Xml_Record_Writer_SYS.Start_Element(xml_,NULL,'xmlns','<?xml version="1.0" encoding="UTF-8"?>',NULL,NULL,NULL,NULL);
        Xml_Record_Writer_SYS.Add_Element(xml_,'UniqueId','||&gt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&lt;',NULL,NULL);
--
       --dbms_xmldom.setVersion(xml_, '1.0" encoding="UTF-8');
       --dbms_xmldom.setCharset(xml_,'UTF-8');
         Xml_Record_Writer_SYS.Start_Element(xml_, 'Document');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','DOCUMENT_NO', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',rec_.doc_no  , NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','TITRE_DOCUMENT', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',DOC_TITLE_API.Get_Title(rec_.doc_class,rec_.doc_no), NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','PROJET_CODE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',rec_.project_id, NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','SOUS_PROJET_CODE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',rec_.sub_project_id , NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','ACTIVITE_CODE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',rec_.activity_no , NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','EVENEMENT_CODE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',code_evt_ , NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','EVENEMENT_LIBELLE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',C_Ref_Evt_API.Get_Lib_Evt(code_evt_) , NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','TACHE_CODE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',task_no_ , NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','UTILISATEUR', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',Person_Info_API.Get_Name_For_User(rec_.user_created), NULL, NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');         
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE', 'DATE_DEPOT', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR' ,rec_.dt_cre,NULL,NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
            
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');           
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','REGION',NULL,NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',rig_,NULL,NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
            
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','COMMUNE',NULL,NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',libcom_,NULL,NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','IMMEUBLE_CODE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',libcom_,NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','IMMEUBLE_ADRESSE',NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',bulling_code_,NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
          
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','IMMEUBLE_ENSEIGNE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',proj_sign_,NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'CLE_SITE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',site_,NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'OWNER', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR' ,customer_id_,NULL,NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'DATE_TACHE', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',date_effective_,NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'FICHIER_NOM', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',file_name_,NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE','PDV', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR' ,pos_no_,NULL,NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'DATE_TRAITEMENT', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',TO_CHAR(sysdate,'DD-MM-YYYY'),NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'DATE_EXPORT', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',TRUNC(sysdate),NULL,NULL);
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'ERROR', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR','',NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');
         
         Xml_Record_Writer_SYS.Start_Element(xml_, 'METADONNEE');
         Xml_Record_Writer_SYS.Add_Element(xml_,'CLE', 'DOCUMENT_REVISION', NULL, NULL);
         Xml_Record_Writer_SYS.Add_Element(xml_, 'VALEUR',rec_.doc_rev ,NULL,NULL); 
         Xml_Record_Writer_SYS.End_Element(xml_, 'METADONNEE');        
     
         Xml_Record_Writer_SYS.End_Element(xml_, 'Document');    
          
         Xml_Record_Writer_SYS.End_Element(xml_, 'Documents');
         Xml_Text_Writer_API.Write_End_Document(xml_);       --IF(rec_.doc_no IS NOT NULL) THEN
         
                
         PLSQLAP_Server_API.Post_Outbound_BizAPI (
                               bizapi_name_  => 'C_SEND_DOCMENT',
                               xml_          => xml_,
                               sender_       => file_name_,
                               receiver_     => '',
                               message_type_ => 'EVENT_BIZAPI'); 

Userlevel 7
Badge +22

OK, I see you export it directly from PL/SQL.

Userlevel 1
Badge +5

Yes but challenging is to add XML Version from the above code.

Userlevel 7
Badge +22

You can check there the API: Post_Outbound_BizAPI (ifs.com)

Maybe you will find something. Otherwise I dnon’t know if it is possible.

Reply