• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

storing attachment files in xml / reading from xml

 
Fon Drank
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a standard way of saving "attachment files" in xml? I have looked and it seems like most people recommend base64 encoding binary data.

So can someone critique my workflow thoughts for attaching files and retrieving them later on from xml?

attach files workflow:
1) user selects the file to attach
2) store the file in memory as a byte stream
3) use some kind of API to base64 encode the byte stream into a String
4) write out the string to xml

retrive file and display workflow:
1) retrieve the String from xml
2) convert to a byte stream using base64 decoding API
3) write out the byte stream to a temp file
4) call high level API to open the file using whatever program the OS associates with the file extension

Any help is appreciated! Also, is there a standardized tagging convention for storing attachments in xml?
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, look at it this way. XML is a format designed for storing textual data. And most of those attachments (you didn't say what you planned to attach them to) are not in any way text. So XML isn't really the first format I would choose for storing that data. I would just store the data as is without modifying it in any way, I don't see any point in wrapping it in XML.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic