I there a possibility to limit the size of an XML upon creation in Vb6 using MSXML?
For example I have to create a like 2GB XML file, but instead I want it to be split in 4 files of 500MB or 2 files of 1GB.
Please let me know the right direction to take in solving this.
Thanks.
This code uses MSXML SAX to write huge amounts of XML, broken into smaller files by testing the size of the output as it goes.
It requires an IStream as
MXXMLWriter.output
and we don't have such an object opened directly on disk in VB6, so a reference to the "olelib" type library is used here. You can get this at:Namespace Edanmo Visual Basic 6 OLELIB.TLB - OLE interfaces & functions v1.7
This is a widely-used type library for such things. The version at that link is actually 1.81 currently.
The code has a loop that writes out simple dummy XML, iterating from 1 to
NUM_DETAIL_ELEMS
as it goes. A new output stream is opened on a new file everyFILE_LIMIT_BYTES
of output. To check this, eachCHECK_LIMIT_INTERVAL
iteration theMXXMLWriter
is flushed to the stream and the stream's size in bytes is checked.Pretty basic really.