Skip to Content.
Sympa Menu

xom-interest - re: [XOM-interest] Serializing objects that contain an instan ce of nu.xom.Document, part II

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Brian Sam-Bodden" <bsbodden AT integrallis.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: re: [XOM-interest] Serializing objects that contain an instan ce of nu.xom.Document, part II
  • Date: Thu, 19 Feb 2004 14:42:07 -0800 (PST)

Nils,
Again thanks for the input. We do have an object
model. Most object are backed by an XML document, but
do not expose every piece of information about the
document. So part of the system just deal with the
object, yet others need to work with the XML structure.
We tried JAXB and CastorXML earlier in our development
but like Rusty points out there are some very real
problems with data binding (akin of to the problems
caused by the object-relation impedance mismatch, we
can call this the object-xml impedance mismatch). From
Rusty's list we encountered pretty much all the
problems he lists:

* Common assumptions:
o Documents have schemas
o Documents are valid.
o Structures are fairly flat and definitely
not recursive.
o Narrative documents aren't worth
considering.
o Mixed content doesn't exist.
o Choices don't exist.
o Order doesn't matter.
So after we were force to abruptly ditch our
"object-colored glasses" ;-) we ended up with a hybrid
solution. Expose only what is extremely necessary to be
able to place our documents in the right processing
context and no more and give processes the ability to
call something like Document getDocument() if they need
to navigate a document in complex ways.
So basically my problem still boils down to
"optimization" (root of all evil I know).

======================================================

Now onto Brendan question:

Brendan,
Ward Cunningham of XP fame put together a short study
of Java serialization that you might find interesting.

http://c2.com/doc/SerializationThroughput/

If you look at systems like Prevayler (prevayler.org)
you see that persistence depends on an object being
serializable. Which brings back the question of: should
the XOM classes be serializable so they can live in
places like Prevayler, Ozone (object database) or many
of the caching implementations that depends of the
*evils* of serialization? I don't know the answer. For
now I think a good compromise it what I did, make
internal class members that are XOM docs, transient and
instead use a DOM object (in my case I need caching of
the XML so that's why I need some sort of parsed
document object). If not I think I agree with Rusty
that you just keep the raw XML inside of your object.

Brian Sam-Bodden
President & Chief Software Architect
Integrallis Software, LLC.
http://www.integrallis.com




Archive powered by MHonArc 2.6.24.

Top of Page