Efficient serialization of binary data within XML documents?

Discussion in 'XML' started by Noozer, Sep 21, 2007.

  1. Noozer

    Noozer Guest

    From what I can find online, the most efficient way to store binary data in
    an XML document is to use Base64 serialization. This results in a 25% waste
    of storage space, since computers store data in 8 bit bytes (or even more
    wasted when other codepages are considered).

    Is there a more efficient way to store binary data within an XML document?
    Perhaps a "8 bit character" codepage that contains 256 "real" characters,
    and that would have a common base regardless of language or dialect?

    I'm trying to figure out a method to store data, such as an music track,
    with album art, lyrics and custom user data that still works well with the
    XML model.
    Noozer, Sep 21, 2007
    #1
    1. Advertising

  2. "Noozer" <> wrote in message
    news:DNQIi.19137$A55.2985@pd7urf2no...
    > From what I can find online, the most efficient way to store binary data

    in
    > an XML document is to use Base64 serialization. This results in a 25%

    waste
    > of storage space, since computers store data in 8 bit bytes (or even more
    > wasted when other codepages are considered).
    >
    > Is there a more efficient way to store binary data within an XML document?
    > Perhaps a "8 bit character" codepage that contains 256 "real" characters,
    > and that would have a common base regardless of language or dialect?
    >
    > I'm trying to figure out a method to store data, such as an music track,
    > with album art, lyrics and custom user data that still works well with the
    > XML model.
    >


    You can't use place raw binary in an XML file. XML is ultimately a text
    based stream.

    First are you sure the 33% bloat is really a problem? You get massive
    amounts to storage for peanuts these days.

    If you're concerned about bandwidth usage that's a different matter.
    However I don't think XML is really a sensible messaging medium to use for
    the transmitting (or indeed storage) of multimedia content .

    Have you considered using a Zip file to contain media files and an XML
    manifest a la M$'s new office document formats.


    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Sep 21, 2007
    #2
    1. Advertising

  3. (Not crossposted to microsoft.public.xml because -- despite its name --
    it does not accept posts from the public, or at least not from that
    portion of the public using non-Microsoft tools.)


    Anthony Jones wrote:
    > However I don't think XML is really a sensible messaging medium to use for
    > the transmitting (or indeed storage) of multimedia content .


    A better solution might be for the XML document to contain a URI that
    can be used to retrieve the multimedia content separately -- the same
    way (X)HTML currently handles images, and for much the same reasons.

    If you must include binary info within an XML document: Base64 encoding
    is simple and effective, available as off-the-shelf code, and
    automatically avoids the cases where XML would have trouble representing
    the character. Yes, you could come up with a tighter representation
    than Base64 which still avoids the problematic characters/ranges, but
    the computational overhead would be nontrivial. If you're worried about
    bloat, I'd suggest that you compress the data before encoding it (good
    practice anyway).

    >
    > Have you considered using a Zip file to contain media files and an XML
    > manifest a la M$'s new office document formats.
    >
    >



    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, Sep 21, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    2,227
    deadsea
    Jan 2, 2005
  2. Replies:
    16
    Views:
    14,740
  3. Replies:
    3
    Views:
    1,011
  4. Dimitri Ognibene
    Replies:
    4
    Views:
    766
    Dimitri Ognibene
    Sep 2, 2006
  5. Ramunas Urbonas
    Replies:
    1
    Views:
    382
    Dino Chiesa [Microsoft]
    Jul 27, 2004
Loading...

Share This Page