Trisli
3rd December 2004, 11:14
Hi all,
I have been trying to generate a large XML file. Unfortunately it seems that I am running into a "buffer full" situation, as the file ends in the middle of the genration phase without ending the file correctly.
Question is now: Is it possible to generate such (very large) XML files?
:confused:
Thanks!
I have attached the (failing) code, that I have been using so far.
Best regards
Soeren Lildal
|******************************************************************************
|* com9999
|* Test - write basic data
|******************************************************************************
|* Script Type: 3GL
|******************************************************************************
table ttiitm001 |* Items
long retVal
extern domain tcmcs.long xml_fileid
extern domain tcmcs.long xml_mainnode
extern domain tcmcs.long file.ptr
function main()
{
xml_fileid = xmlNewNode("Items", XML_ELEMENT)
select tiitm001.item, tiitm001.dsca
from tiitm001
selectdo
xml_mainnode = xmlNewNode("Item", XML_ELEMENT, xml_fileid)
retVal = xmlNewDataElement("Item", strip$(shiftl$(tiitm001.item)), xml_mainnode)
retVal = xmlNewDataElement("Description", strip$(shiftl$(tiitm001.dsca)), xml_mainnode)
endselect
retVal = xmlWritePretty(file.ptr, xml_fileid, 0 )
seq.close(file.ptr)
file.ptr = 0
retVal = xmlDelete(xml_fileid, 0)
}
|* **** end of source ****
| I tried generation the file record-by-record using the functions below, but could not obtain
| a valid XLM format of the final file
|
| string test.buffer(1024)
|
| Main:
| xmlWritePrettyToString(test.buffer, xml_fileid)
| Each row:
| xmlWritePrettyToString(test.buffer, xml_mainnode, xml_mainnode )
|
| This did indeed result in individual nodes being generated one-by-one, but for each of them
| a line containing: <?xml version="1.0"?> was generated. Furthermore I could not figure out
| how to generate the closing of the main-node.
I have been trying to generate a large XML file. Unfortunately it seems that I am running into a "buffer full" situation, as the file ends in the middle of the genration phase without ending the file correctly.
Question is now: Is it possible to generate such (very large) XML files?
:confused:
Thanks!
I have attached the (failing) code, that I have been using so far.
Best regards
Soeren Lildal
|******************************************************************************
|* com9999
|* Test - write basic data
|******************************************************************************
|* Script Type: 3GL
|******************************************************************************
table ttiitm001 |* Items
long retVal
extern domain tcmcs.long xml_fileid
extern domain tcmcs.long xml_mainnode
extern domain tcmcs.long file.ptr
function main()
{
xml_fileid = xmlNewNode("Items", XML_ELEMENT)
select tiitm001.item, tiitm001.dsca
from tiitm001
selectdo
xml_mainnode = xmlNewNode("Item", XML_ELEMENT, xml_fileid)
retVal = xmlNewDataElement("Item", strip$(shiftl$(tiitm001.item)), xml_mainnode)
retVal = xmlNewDataElement("Description", strip$(shiftl$(tiitm001.dsca)), xml_mainnode)
endselect
retVal = xmlWritePretty(file.ptr, xml_fileid, 0 )
seq.close(file.ptr)
file.ptr = 0
retVal = xmlDelete(xml_fileid, 0)
}
|* **** end of source ****
| I tried generation the file record-by-record using the functions below, but could not obtain
| a valid XLM format of the final file
|
| string test.buffer(1024)
|
| Main:
| xmlWritePrettyToString(test.buffer, xml_fileid)
| Each row:
| xmlWritePrettyToString(test.buffer, xml_mainnode, xml_mainnode )
|
| This did indeed result in individual nodes being generated one-by-one, but for each of them
| a line containing: <?xml version="1.0"?> was generated. Furthermore I could not figure out
| how to generate the closing of the main-node.