Hi,
How to create a XML with below type of tags in Plsql.
Please suggest.
Hi,
How to create a XML with below type of tags in Plsql.
Please suggest.
Please anyone can suggest how we can write in PLSQL.
What did you try, and what happened?
Hi Mathias,
i have tried this way to generate the XML
DBMS_LOB.createtemporary(xml_, TRUE);
Xml_Text_Writer_API.Init_Write_Buffer;
--<?xml version="1.0" encoding="UTF-8"?>;
Xml_Record_Writer_SYS.Start_Element(xml_, 'Documents');
-- );
Xml_Record_Writer_SYS.Add_Element(xml_,'UniqueId',sys_GUID(),NULL,NULL);
Xml_Record_Writer_SYS.Add_Element(xml_,'Timestamp',SYSDATE,NULL,NULL);
Xml_Record_Writer_SYS.Add_Element(xml_,'SchemaVersion',4.71,NULL,NULL);
Xml_Record_Writer_SYS.Start_Element(xml_, 'Document');
Xml_Record_Writer_SYS.Add_Element(xml_, 'DOCUMENT_NO',rec_.doc_no , NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'TITRE_DOCUMENT',DOC_TITLE_API.Get_Title(rec_.doc_class,rec_.doc_no) , NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'PROJET_CODE',rec_.project_id, NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'SOUS_PROJET_CODE', rec_.sub_project_id, NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'ACTIVITE_CODE',rec_.activity_no,NULL,NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'EVENEMENT_CODE',code_evt_, NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'EVENEMENT_LIBELLE',C_Ref_Evt_API.Get_Lib_Evt(code_evt_),NULL,NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'TACHE_CODE',task_no_, NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'UTILISATEUR',Person_Info_API.Get_Name_For_User(rec_.user_created), NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'DATE_DEPOT','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'REGION','',NULL,NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'COMMUNE','',NULL,NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'IMMEUBLE_CODE','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'IMMEUBLE_ADRESSE','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'IMMEUBLE_ENSEIGNE','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'CLE_SITE','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'OWNER','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'DATE_TACHE','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'FICHIER_NOM','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'PDV','false', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'DATE_TRAITEMENT','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'DATE_EXPORT','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'ERROR','', NULL, NULL);
Xml_Record_Writer_SYS.Add_Element(xml_, 'DOCUMENT_REVISION','', NULL, NULL);
Xml_Record_Writer_SYS.End_Element(xml_, 'Document');
Xml_Record_Writer_SYS.End_Element(xml_, 'Documents');
Xml_Text_Writer_API.Write_End_Document(xml_);
PLSQLAP_Server_API.Post_Outbound_BizAPI (
bizapi_name_ => 'C_SEND_DOCMENT',
xml_ => xml_,
sender_ => 'IFS',
receiver_ => '',
message_type_ => 'EVENT_BIZAPI');
It is generating like this ..
Hi
I personally prefer DBMS_XMLDOM
over Xml_Record_Writer_SYS
.
Here’s a blogpost on how to use dbms_xmldom to create XML
https://dsj23.me/2019/09/18/how-to-use-dbms_xmldom-to-create-xml-from-pl-sql/
Cheers!
Damith
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.