I have an entity tree, which is fetched by hibernate, and I want to generate xml from the entity tree. In this tree, there are many blob and clob data type. I don’t want to include them in xml, rather I want to keep a reference id in the xml. The blob and clob data will be stored in the file system in the same directory where I put xml.
the generate xml formate sample-
<Address type="varchar" maxLength=”100”>
Los Angeles, CA 90067-6209, USA
</Address>
<Biography type="clob">
<!-- this clob data would be available in the same directory of this xml as a text file. Name format- [row_id]_biography -->
<ref id="44238185_biography"/>
</Biography>
<Image type="blob">
<!-- this blob data would be available in the same directory of this xml as a image file. Name format- [row_id]_image -->
<ref id="44238185_image"/>
</Image>
<DateCreated type="timestamp" format="yyyy-mm-dd hr:mm:ss">
18-04-13 05:12:34
</DateCreated>
I would like to know how do you guys think about this.
How about storing your BLOB and CLOB data in base64 encoded format?
If you don't want to store your BLOB and CLOB data in file system and have reference to it, you can user base64 encoding. base64 encoded string can later be used to retrieve you data from xml file itself.
Pros:
Cons: