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
Sedna-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to