Create XML File

  • Thread starter Thread starter Mary1982
  • Start date Start date
M

Mary1982

Guest
Hello,

I need your help. We must create an xml file with invoices informations for goverment e-books. Then we must upload it and take back a response.

For now I create xml file from a select query:

SELECT invoiceNr, invoiceDate FROM invoiceHeader

OUTER APPLY ( SELECT lineNumber, netValue, vatCategory FROM invoiceDetails WHERE invoiceDetails.headid = invoiceHeader.unid FOR XML PATH('invoiceDetails') ) XmlinvoiceDetails(invoiceDetails)

FRO XML PATH('invoice'), root('invoicedoc')


and using SQLDataReader and StreamWriter we are saving xml on disk.

Then with WebRequest we upload xml file and get a response back as xml file. That file (response.xml) has a sequential number 1,2,3 e.t.c. with information (success or not) for every invoice node we upload.

First of all I need to know if there is another way of creating xml file, more efficient because in xml file we will have many invoices and we want very quickly to create xml file.

Second, we want to find a way of updating records we have exported in xml file, perhaps with unique index because we want to know every record in which xml file has been exported and with which order or in which xml line node has been written, in order getting the response.xml with the results to update each record with the status code (success or not).

Pls help us, we need your opinion and of course we need to know the most efficient way to do this because there are millions of records.

Continue reading...
 
Back
Top