I have an app that saves its documents in XML format. Among other stuff, it has to save matrices (floating point format). In order to embed binary content in an XML document, I’m encoding the binary data in Base64. This works fine if the data matrix is not larger than 2048x2048. With higher dimensions (e.g. 4096x4096), the encoding/coding process takes too long and it is too memory consuming as well.

Is there a better approach to deal with binary content in a XML document?

I’m considering two options:

(1) Save the binary information in a separate binary file, The XML file will simply include a link to this file. 

This is a good approach, except that your files won't be self-contained.

(2) Would it be possible to save the binary information in a CDATA section?  

Nope - the data might just contain the ]]> sequence for example.

 

What I can suggest is to use compression on your matrix.  zlib compression is easy to integrate in your app.  Then, you can base64-encode the compressed data.  Alternatively, you can compress both your XML and the related binary data files together in a single package to make it self-contained.  The latter solution probably creates smaller documents.


Ideas that fall under shadows of theories that stand tall, thoughts that grow narrow upon being verbally released.
_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription 
changes, and list archive.

Reply via email to