Luca,

You're attempting to store Java Objects straight into an XML Database.
Using XML Databases as a Java Object store is a cool idea, except the
current way you're trying store these Objects turns the Java Objects into
serialized binary data, which means they're no longer indexable or
searchable from within Sedna.

I suggest you check out XStream http://xstream.codehaus.org/ and if that
doesn't take your fancy then JAXB.

On another note, please consider checking out the Sedna XQJ API instead of
the Sedna XML:DB API.

* The Sedna XQJ API is standards based. Developed by the JCP.
* Is an ideal interface for Sedna XML Database.
* Has many more features than the Sedna XML:DB API.
* Is continually being developed.

Kind Regards,

Charles



> Luca,
>
>
> I'm using the XML:DB API with the following code:
>> ...
>>       BinaryResource br = (BinaryResource) c.createResource(h.id,
>> BinaryResource.RESOURCE_TYPE);
>> ...
>>     <document name="" total_nodes="3" total_blocks="1"
>> total_ext_nids="0"
>> total_indir_blocks="0" total_text="36">
>>       <element name="base64Binary" total_nodes="3" total_blocks="1"
>> total_ext_nids="0" total_indir_blocks="0" total_text="0">
>>         <attribute name="mimetype" total_nodes="3" total_blocks="1"
>> total_ext_nids="0" total_indir_blocks="0" total_text="174"/>
>>         <text name="" total_nodes="3" total_blocks="1"
>> total_ext_nids="0"
>> total_indir_blocks="0" total_text="468"/>
>>       </element>
>> ...
>
>
>
> BinaryResource is not structured. It just a BLOB. Most likely, XML:DB
> driver
> serializes object (into String or bytes array), then base64-encodes them
> and
> inserts into database something like this:
>
> <base64Binary>
> kljh31g23LKj123H4iLutgLJhb=
> </base64Binary>
>
> What you actually need is XML representaion of the Host object and
> XMLResource (
> http://www.cfoster.net/html/xmldb/javadoc-xmldb-api/org/xmldb/api/modules/XMLResource.html)
> instead of BinaryResource. There are a lot of ways to serialize java
> objects
> into XML - from concatenating to using StAX writers. I would start from
> there: http://stackoverflow.com/questions/35785/xml-serialization-in-java
> and
> here
> http://www.java2s.com/Code/Java/JDK-6/MarshalJavaobjecttoxmlandoutputtoconsole.htm
>  .
>
> BTW, this XML:DB API example should be interesting for you also:
> http://www.cfoster.net/sedna/xmldb/examples/quick-start.xml .
>
>
> Ivan Shcheklein,
> Sedna Team
> ------------------------------------------------------------------------------
> Forrester Wave Report - Recovery time is now measured in hours and minutes
> not days. Key insights are discussed in the 2010 Forrester Wave Report as
> part of an in-depth evaluation of disaster recovery service providers.
> Forrester found the best-in-class provider in terms of services and
> vision.
> Read this report now!
> http://p.sf.net/sfu/ibm-webcastpromo_______________________________________________
> Sedna-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>


------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to