I have to use an xml database (Sedna) to store and retrieve Java objects. Every custom class in the project is stored into a collection. I have the following problem : I'm not sure how the objects are written into the collection. That is to say, I don't know their exact xml structure, so I can't do a proper query on them.
Is there a query that, for a given collection, will show me the content of a collection?
Host h = new Host();
h.name = "test1";
h.freeSpace = 32;
String id1 = this.addHost(h);
//addHost method
try
{
Collection c = this.findCollection("Hosts"); //gives me the Hosts collection
if (c == null)
return null;
h.id = c.createId();
BinaryResource br = (BinaryResource) c.createResource(h.id, BinaryResource.RESOURCE_TYPE);
br.setContent(h);
c.storeResource(br);
return h.id;
} catch (XMLDBException e) {
System.err.println("Error adding Host entry into the database: " + e.getMessage());
return null;
}