• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

storing attachment files in xml / reading from xml

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic