C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » XML »

Embedding binary data in XML


Posted Date: 01 Jan 2009    Resource Type: Code Snippets    Category: XML
Author: Gollapudi Ramya KrishnaMember Level: Gold    
Rating: 1 out of 5Points: 10



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






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Binary data  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: SAX parser
Previous Resource: Populate a Dataset with an XML file
Return to Discussion Resource Index
Post New Resource
Category: XML


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use