Timo Salmi: Another alternative is to store the data in XML format. This is a lot more complicated alternative because there are no ready tools available to parse arbitrary Java class. Or is there?

Yes, there is a standard API for serializing Java objects into XML. However, this is not what you want either, because searches into the database are probably even more complicated (parsing XML is not trivial and fast, and it wastes space).

JanneJalkanen : I found an interesting link to Castor, a way to marshal/unmarshal Java Beans into XML. There's a good article explaining what Castor is at onjava.com

PhilippeO : I rather prefer Dom4J, or JDOM for that.

TomZ: I have used both (JDOM and Castor XML) in some projects. I feel that these frameworks try to solve different problems:

Tries to provide direct access to an XML document in a more obvious oo-like style. While...
Castor XML
is a framework for (un)marshalling Java objects to XML files. For example, if you have an XML Schema, Castor will create for you all java classes you need. That was really amazing to me when I tested it first time. A tag like <my-tag> will become a class called MyTag with all methods you need to manipulate this class in a way that is consistent with what the schema says. When you got those classes you work with them as with normal java classes. Finally, you just marshall them back with just one call.

DuncanMcGregor has just been using XStream, and finds it great for unsophisticated read and write object graphs.

YishayMor: In our notes prototype uses java.beans.XMLDecoder and java.beans.XMLEncoder. Its a quick 'n dirty sollution, and not a bad one as far as that goes. You have no control over the schema, but using it is very straightforward.
We used Castor back in Cisco. It was reasonable. I'd also look into SUN's JAXB. As for search etc., you might want to consider an XML database (unless the point was to avoid the DB in the first place). Whenever I need to do some new XML project, I take a look and see what's new on http://www.xml.org/ and http://www.alphaworks.ibm.com/xml. Dennis Sosnoski's article compares several technologies, and is probably worth a read.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-13) was last changed on 23-May-2006 10:46 by Jérôme Duprez