From: gregarican Date: 2006-10-21T12:20:11+09:00 Subject: Re: rexml difficulties This is something that I personally use for a Ruby routine I have that stores stock item images for the retail jewelry company I work for. I extract JPG images and store them as Base-64 encoded elements in an XML file. Then I port that into a SQL database. To extract the images I just decode them. Works like a charm and perhaps saves some SQL resources since I'm not storing the images and actual BLOB items... James Britt wrote: > Harold Hausman wrote: > > > It sounds like you might have some experience in this area. Not to > > hijack the OP, but could you possibly describe the process you would > > go through if you had a completely random pile of binary barf that you > > wanted to store as an XML attribute? > > > > Would your process include using Base64? > > http://www.topxml.com/xml/articles/binary/ > > "Base64 encoding, specified in RFC 2045 - MIME (Multipurpose Internet > Mail Extensions) uses a 64-character subset (A-Za-z0-9+/) to represent > binary data and = for padding. Base64 processes data as 24-bit groups, > mapping this data to four encoded characters. It is sometimes referred > to as 3-to-4 encoding. Each 6 bits of the 24-bit group is used as an > index into a mapping table (the base64 alphabet) to obtain a character > for the encoded data. According to the MIME specification the encoded > data has line lengths limited to 76 characters, but this line length > restriction does not apply when transmitting binary data as part of XML > document." > > > > It's a common, practical approach. > > > -- > James Britt > > "Every object obscures another object." > - Luis Bunuel