[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serializing objects to and from XML documents.



On Mon, 10 Jan 2000, Eric van der Vlist wrote:
> > this one is on the to-do list already. We did not start working yet. Our first
> > idea was to make a DOM that converts database content into XML using
> > reflection and a given mapping (KOALA, BML or something). This would allow to
> > access the entire database content via DOM and standard XML tools. The DOM
> > methods that change nodes are a problem and not the only one I guess ;) So we
> > need a good spec before we can start coding. Any ideas?
> 
> http://java.sun.com/xml/docs/binding/DataBinding.html ?

> > > It wouldn't be storing a DOM in ozone, but rather to convert DOM nodes
> > > to object properties...
> > Again, code that allows you to store/retrieve just simple XML data is already
> > part of the current ozone package.
> > 
> > >
> > > I see many benefits of doing this.
> > >
> > > The input from XML would allow an easy initialization of complex
> > > objects.
> > > The output to XML would facilitate the usage by web application (using a
> > > XSL transformation to produce HTML or XML).
> > > The output + input would allow a kind of logical dump of objects.
> > Yes, today oozone lacks an ad-hoc query interface/tool. XML/DOM seems to be
> > perfect for this.
> > 
> > >
> > > With the few things I have seen of ozone, it looks like it would be
> > > quite easy to implement a generic mechanism by extending the OzoneObject
> > > class...
> > Oh, not that easy, IMHO. ;)
> 
> It depends on the level of functionalities you want to accommodate... 
> 
> A simple mechanism where the programmer would define a specific
> constructor which would manage all the attributes and handlers to manage
> the sub elements would be quite straightforward to implement.
Yes, this can be done quickly without changing any ozone core code. A
better way would be a toDOM() (or maybe toSAX()) method instead of toXML().
This would allow to directly access database content via standard XPATH
or something. toDOM() is maybe a bit harder to implement but still a quick
solution.

For the general ozone XML mapping solution we need something like Sun's
XML Data Binding. But IMO ozone XML mapping and XML Data Binding have different
goals. While Sun tries to "automatically generate substantial portions of the
Java platform code that processes XML data" - the ozone mapping will try to map
*existing* database objects to XML/DOM (using a specified mapping) to allow
querieng/processing via standard XML tools. At least in my current understanding
this is the goal ;) Ideas?

> And a simple mechanism defining toXML methods ala toString wouldn't be a
> big deal either.
> 
> It's what I had in mind when I wrote my first email.
> 
> I have discovered since that there may be more clever ways to do it :=)
>  
> > First we have to decide...
> > 1. which mapping to use.
> > 2. what is the database API for this new thing.
> > 
> > Ideas, experiences?
> 
> I am investigating "Quick" http://www.jxml.com/quick to see if it can be
> used with ozone.
Please, tell us about your experiences.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                         mailto:falko@softwarebuero.de
softwarebuero m&b (SMB)                    http://www.softwarebuero.de