Jaroslaw Staniek wrote:
I wonder why OASIS picked to only use compressed XML as a medium: -it will also not work well for video data, BTW. -OpenOffice.org Base already failed to deliver robust solution because 100% of the data has to be processed on loading/saving (unless it's stored on the server).
Heh. I've been working on saving .odg data from Inkscape for a couple of weeks now, so I have experienced the hell of the Zip format. ;-) I don't have an opinion on this stuff, but I thought I would send some FYI stuff while waiting for the pizza to arrive.
Actually, the entries of a zip can be saved with compression method '0', which means no compression. This allows normal streaming, with the benefit that you know the output size (==input size) before each file is attached to the zip. Also, all files are added at the front, and the directory is sent last, which means that all information is known by the time the directory is sent, which also supports streaming. No seeking is required. And, really, since all information is sent for each file, the directory at the end is not needed at all. Which means, theoretically, there can be an infinite stream of file chunks.
Compression could be done, too, with compression method '8' (deflate). This means that unless you want to buffer the whole thing in memory, like you say, the header info cannot store the compressed size without a seek, thwarting streaming. However, the zip format has a hack for this, too. If the flags at the start of each file header have bit 8 set, that tells the zip reader that the file's compressed and uncompressed sizes are unknown, and those bits, along with the crc, will be sent immediately following the compressed data. This would also work if you don't know the input stream length (like video).
HOWEVER ========= But there is one special trick to ODF that nobody ever uses. Zip is -NOT- required by the specification. (Though OO.org wants it.) You can fit everything into a single XML file, separating the different file pieces with XML namespaces, and have it be a perfectly valid and useful ODF file. People just don't use it because OO.org doesn't output data this way.
So, in theory, you could send ODF in a stream of XML stanzas much like Jabber.
bob (ishmal)