Embedding binary data in XML

Embedding binary data in XML
?? Raw binary data cannot be embedded in XML 1.0 safely
?? Legal characters are tab, carriage return, line feed, and the legal
characters of Unicode and ISO/IEC 10646
?? Certain binary sequences can make the document ill-formed


ps.jpg
img/jpg
2006-03-01


// You can't serialize raw binary data here



Encoding binary data
?? One solution is to encode binary data into legal characters
?? Then embed the encoded data into the XML 1.0 document
?? The most common encoding scheme is Base64 (RFC 2045)


ps.jpg
img/jpg
2006-03-01



sdcfo2JTiXE=...



Decoding Base64 data
?? The other side will need to decode the embedded Base64 data
?? Produces the original binary data again


ps.jpg
img/jpg
2006-03-01



sdcfo2JTiXE=...



Referencing by URI
?? An alternate approach is to reference binary data by URI
?? XSD provides the anyURI datatype to distinguish from strings
?? Address resolved and data downloaded separately (a la HTML)
?? Resolution problematic in network transitions (firewalls)


ps.jpg
img/jpg
2006-03-01



Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: