Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Serializing objects that contain an instance 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: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: "Brian Sam-Bodden" <bsbodden AT integrallis.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Serializing objects that contain an instance of nu.xom.Document, part II
  • Date: Thu, 19 Feb 2004 15:24:53 -0500

At 11:41 AM -0800 2/19/04, Brian Sam-Bodden wrote:
XOM users,
Okay, read the "java rules" section of the "what's
wrong" presentation. So, no XOM classes are
serializable. My problem is one of avoiding parsing a
document more than once. When I was using DOM (yuck!) I
could do many things with my DOM objects such as hang
them on a JNDI tree and retrieve them later, pass them
in JMS messages as Object Messages and other niceties
that come with being serializable. I'll find a way
around this but I would still like to understand the
reasons for not implementing serializable?



XML is itself a serialization format. In fact, it is a much cleaner, more interoperable format than Java's object serialization. Using object serialization limits you to exchanging data only with other Java programs. Without a great deal of care and effort, it limits you to exchanging data only with other programs that use the identical version of XOM.

XML, by contrast, can be used to exchange data with Python programs, DOM programs, Perl programs, C++ programs, C# programs, and far more. These programs can use the same or a different version of XOM. They can use other APIs like SAX, DOM, JDOM. Even human beings can easily read and work with the data using a simple text editor.

Binary formats are bad in general, and Java's object serialization is far from the best binary format. Object serialization routinely violates access protection, interferes with class loading, breaks various design patterns, is slow as spit, and in general causes far more problems than it solves. XML is far cleaner, more reliable, more robust, and faster. Use XML.
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



Archive powered by MHonArc 2.6.24.

Top of Page