I found this same solution searching around the net - looks like it'll
work perfectly. Thanks for suggesting it also!

--
Matt Perkins
-----------------
http://www.nudoru.com

On Jul 28, 2010, at 9:53 PM, Juan Pablo Califano
<califa010.flashcod...@gmail.com> wrote:

> PS: Just made a quick test with a rather big xml and this is what I got
> (sizes are in bytes):
>
> xml:   49725
> compressed bytearray: 9488
> compressed bytearray + base 64: 12652
>
> The figures may vary as the compression depends on the data, but at least
> here I got about a 1/4 of the original size after encoding to base 64, which
> is not bad, I'd say.
>
> Cheers
> Juan Pablo Califano
>
> 2010/7/28 Juan Pablo Califano <califa010.flashcod...@gmail.com>
>
>> I'm not sure you are really going to gain that much by using JSON instead
>> of XML.
>>
>> ByteArrays have built-in compression as you mention (I think the
>> compression algorithm zlib). Since XMLs generally have a fair amount of
>> redundancy, it will probably reduce the size of your data (in bytes)
>> considerably. To be safe, encode the bytearray to base 64 and store that.
>> Base 64 means 1/3 overhead (for every 3 bytes in, you get 4 bytes out).
>> Still, it'll probably be smaller than the equivalent JSON (though you might
>> want to test it and see if this is true).
>>
>> Cheers
>> Juan Pablo Califano
>>
>> 2010/7/28 Matt Perkins <nudoru.m...@gmail.com>
>>
>> Wondering if someone has had this problem and found a good solution ...
>>>
>>> I've developed a social simulation that has a lot of data that i need to
>>> save between user sessions in the suspend_data SCORM variable to our LMS.
>>> I'm formatting this data as XML since 1, has a good structure and 2, i know
>>> it. Suspend_data only has 4k of space and my XML (as a string) is pretty big
>>> - doubly so since the LMS encodes it and all of the single char <, > and /'s
>>> get turned into 4 chars. But i've used attributes and 1-2 char tag names
>>> where i can.
>>>
>>> I'm going to try to compress the string with ByteArray and see if that
>>> helps, but I'm not sure if the "special characters" will mess with the LMS
>>> communication - I've had that happen many times before with just HTML page
>>> text.
>>>
>>> Other option is to learn JSON and do it that way.
>>>
>>> Have anyone else faced something like this and solved it?
>>>
>>> --
>>> Matt Perkins
>>> --------------------
>>> http://www.nudoru.com
>>>
>>> _______________________________________________
>>> Flashcoders mailing list
>>> Flashcoders@chattyfig.figleaf.com
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>
>>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to