Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store Blob into CDATA

Status
Not open for further replies.

jumper2

Programmer
Jul 13, 2007
41
ES
Hello Everybody,

can somebody help me out, my problem is the following =>

I have an xmlDocument with a CDATA section where I like to add the Blob data but I'm not sure how.
I have this like:

InputStream myInStr = myBlob.getBinaryStream();
Element myRootElement = myDoc.getRootElement();
Element myItem = new Element( "datafromblob" );
myRootElement.addContent(myItem);

myItem.addContent(new CDATA( ...don't know how to add ) );

Can somebody tell me how I can say to this addContent that the CDATA should contains myBlob??




 
Is there anybody wo already add Blob into XML??
 
Hi Dian,
sorry, I don't get you.
Can you help me?
 
I had a look that 2 suggestions, but the main things what I really need was not in.

I also able to create a CDATA section but I don't know how I can put Blob type into this CDATA.
 
Get the data from the Blob and put is as text in the CDATA.

Cheers,
Dian
 
Hi Dian,
thank you for your hint!
Maybe do you have an example for it?

 
My java setup for the purpose is fragmentary so I cannot at this point of time give you working sample. But I can suggest the conceptual ingredients for that be done.

First [1], you must not consider CDATA section as a viable solution. The name suggests character data, not binary data as the B of Blob suggests. Second [2] you begin by setting the dataType attribute of the element node you want to put the blob data into as "bin.base64". Then [3] you send the binary data stream to the element as its nodeTypedValue property. You basically have got it done by then.

When you view the persistent xml storage, it shows up in base64 encoded text. When you want to retrieve it for use, you retrieve it again via calling its nodeTypedValue. This is the read-write aspect of the thing.
 
Sorry, I really lost the track.
Please, can somebody provide me a piece of code where I can see what I we are talking about?
 
In the language we cannot assume familiar with in the forum, check this out for the general idea and setting.
For the lanugage proper to this forum, this dated article for the general idea.
A more practical illustration more on decode than encode, check this out.
I can search and everybody else can including yourself with the basic idea now clearer?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top