Thursday, March 14, 2024

Import of XML file

 public static void main(Args _args)

   {

       XmlDocument responseDoc;

       XmlNodeList data;

       XmlElement  nodeData,payment_Indicator,payment_Date,uniqueCustRefNo,debitAccountNo,nameofBeneficiary,

                   vendorBeneficiaryCode,beneficiaryBankAcNo,beneficiaryBankIFSCCode,instrumentAmount,

                   remarks,txnStatus,txnUTR,txnREMARK,txnProsDate;

       

       //#define.filename(@'C:\Temp\sales.xml')//ToDO: File name to be given

       #define.filename(@'E:\Response\05032024_113245_INVEST_INDIA_RES.xml')//ToDO: File name to be given

       responseDoc = XmlDocument::newFile(#filename);

       data = responseDoc.selectNodes('//'+"Data");

       nodeData = data.nextNode();

 

       try

       {

           ttsbegin;

           while(nodeData)

           {       

               payment_Indicator = nodeData.selectSingleNode("Payment_Indicator");

               payment_Date = nodeData.selectSingleNode("Payment_Date");

               uniqueCustRefNo = nodeData.selectSingleNode("UniqueCustRefNo");

               debitAccountNo = nodeData.selectSingleNode("DebitAccountNo");

               nameofBeneficiary = nodeData.selectSingleNode("NameofBeneficiary");

               vendorBeneficiaryCode = nodeData.selectSingleNode("VendorBeneficiaryCode");

               beneficiaryBankAcNo = nodeData.selectSingleNode("BeneficiaryBankAcNo");

               beneficiaryBankIFSCCode = nodeData.selectSingleNode("BeneficiaryBankIFSCCode");

               instrumentAmount = nodeData.selectSingleNode("InstrumentAmount");

               remarks = nodeData.selectSingleNode("Remarks");

               txnStatus = nodeData.selectSingleNode("TxnStatus");

               txnUTR = nodeData.selectSingleNode("TxnUTR");

               txnREMARK = nodeData.selectSingleNode("TxnREMARK");

               txnProsDate = nodeData.selectSingleNode("TxnProsDate");

               nodeData = data.nextNode();

           }

           ttscommit;

           //Info("File is processed");

           info(strFmt("%1,%2,%3,%4",payment_Indicator.text(),payment_Date.text(),uniqueCustRefNo.text(),debitAccountNo.text()));

       }

       catch (Exception::Error)

       {

           Throw (Exception::Error);

       }   

   }

.....................






No comments:

Post a Comment