XML and Java: Serialization APIs
December 9, 1998
According to
JavaSoft's Object Serialization documentation:
"Object Serialization supports the encoding of objects, and
the objects reachable from them, into a stream of bytes; and it supports the
complementary reconstruction of the object graph from the stream.
Serialization is used for lightweight persistence and for communication via
sockets or
Remote Method Invocation (RMI)."
Serialization is often used to save the state of an application as a binary
representation of all the objects with their current values. Unfortunately,
serialized components are fragile, being sensitive to changes in the classes
used to produce them. Therefore XML APIs that handle Java serialization
provide a useful alternative: a human readable (and editable) persistent
state format. This enables you to keep data in a form you can examine if
software fails (as opposed to keeping data in objects that can only be
accessed via methods).
Koala Object Markup Language (KOML)
URL:
http://www.inria.fr/koala/XML/serialization/
Technical Notes:
http://www.inria.fr/koala/XML/serialization/komltech.html
API Documentation:
http://www.inria.fr/koala/XML/serialization/komlapi/index.html
Koala XML serialization provides an easy way to serialize
and deserialize Java Objects in an XML document.
(Koala is the French acronym for toolkit for advanced software environment.)
This is a 100% pure Java solution with support for SAX. KOML defines a
DTD and Namespace.
Koala XML Serialization uses the Java serialization in a two-step process:
- Serialize all objects with the class java.io.ObjectOutputStream
- Convert the object stream into a KOML document.
Deserialization of a KOML object involves the reverse steps:
- Convert the KOML document into an object stream.
- Deserialize all objects with the class java.io.ObjectInputStream
Coins (JXML)
URL:
http://www.jxml.com/coins/
API Documentation:
http://www.jxml.com/coins/api/com/jxml/xml/package-summary.html
JXML home page:
http://www.jxml.com/
Mailing List Archive:
http://www.jxml.com/archive/java-xml-interest/
Coins is essentially a mechanism for connecting XML elements with JavaBeans.
Bill la Forge,
president of JXML, once said that a Coin consists of two "faces": an XML
element is the persistent form, and the JavaBean instance in the runtime
form. Coins has undergone many changes of focus since Bill la Forge first
presented it as an alternative to Java serialization; the name
"Coins" relates to its original EDI focus when la Forge worked
for The Open Group. On the Coins
mailing list,
java-xml-interest,
JP Morgenthal of
NC.Focus succinctly summarized
Coins in December 1998 as follows:
"Coins is a programming paradigm for associating
elements with executable [behavior through] the use of a bindings
document. Today these binding documents use JavaBeans (or they soon will),
but they could use any supported execution environment. The purpose of
Coins is to process XML documents that have nothing to do with development
(ie. a Web page). Coins works by associating the Element name <HR>
with the JavaBean to draw a horizontal rule on screen. Think of Coins as
following the model/view/controller paradigm, whereby the model is the
XML document, the view is bindings document (also written in XML),
and the controller is the Coins runtime."
According to the
Coins documentation:
"Coins uses a SAX-conformant parser and the
Docuverse DOM SDK
to convert an XML document into a [DOM] tree of objects, each
object corresponding to an element in the XML document. The classes of the
objects used to construct this tree fall into four groups, all of which must
implement the W3C DOM Element interface:
- The
SimpleElement class, which supports ID attributes.
- Application-specific classes. This includes the Bindings, Coin, and Link
classes in the com.jxml.coins package.
- The
Wrapper class, for holding an application-specific object. If the
application class has an appropriate constructor, the application object
is given a reference to the wrapper object that holds it.
- Wrapper classes generated with the
Mint Utility.
These wrappers use the bean property methods of the object
they hold to connect that object with the data from the XML
document."
XML and Java: DOM Level 1: Java XML API Definitions (W3C)
XML and Java: The Perfect Pair: Part 2: Java APIs for XML
XML and Java: Other APIs
|