XMLCoDe
A free implementation of an XML COder/DEcoder:
a Java XML serialization/deserialization tool
This package provides tools for easily and automatically serializing/deserializing Java objects to/from XML strings or streams. It provides a way to easily implement an XML persistent object model. It features support for a scheme for accessor methods use, support for an advanced inheritance scheme, native support for array, vector, and hashtable data structures, as well as native support to serialize/deserialize graph structures (cross-referenced objects).
This sofware was initially released (version 0.3) by Sylvain Guerin on picolibre.enst-bretagne.fr/projects/xmlcode/
The version distributed here (version 1.0), has been enhanced with many new powerfull features including:
- Support for graph-structure serialization/deserialization.
- Support for builders and finalizers.
- Support for using XMLCoDe as XML generator.
- Many other new features, see Detailed review and discussion of main features.
This new version 1.0 is now been released under Lesser GPL licence by Sylvain Guerin and Agile Birds.
Inquiries & questions to author of this software at Sylvain Guerin.
Main features
-
This package provides tools for automatically serializing and deserializing Java objects to/from XML strings and streams. In other words, this package provides a way to easily implement a XML-persistant object model.
-
These operations are processed in a very easy and efficient manner, without need to specify anything else.
-
Any object could be handled by this package, since objects need only implement an empty interface XMLSerializable.
-
To implement this, you need to define a external mapping model, where the mapping between Java world and XML tags should be defined (you should also decide which data you want to serialize, in order to get a consistent model).
See package documentation and example 1 for more explanations on that process. Soon an 'how-to' documentation. -
This package supports an advanced object inheritance scheme.
See example 2 to show those issues. -
This package supports accessors methods use scheme, which allow you to automatically maintain a consistent object model.
See examples 1 & 2 to show those issues. -
Advanced data structures vector and hashtable are natively supported.
See example 2 to show examples of those data structures. -
Other custom data structures could be easily supported through use of accessors methods. (NB: those developpements are welcome to enhance the current XMLCoDe version).
-
This package works with/over parser and transformer softwares.
NOTA: This distribution comes with an implementation of a parser software (JAXP1.1) but you can easily change this for other parsing software. -
See the detailed review and discussion of/on main features for more informations.
Technical documentation
-
Detailed review and discussion of main features
This document reviews all general features provided by this library. This document should be read prior to all other documents, as it contains general informations to understand coding/decoding process.
-
Getting started: writing a model (Java/XML mapping), a short reference guide
This document introduces you with a basic example to the writing of an XMLMapping and according Java classes.
-
Advanced feature: mapping graph structures
This document introduces you with internal scheme used by XMLCoDe to serialize and deserialize graph structures, by maintaining reference identifiers.
-
Advanced XML mapping definitions: contextual XML Tags
This document introduces you with a more complex example of mapping definition in the context of graph structures. We will see here how to code complex data structures with graphs, and inheritance. We will see how contextual XML tags technique may be efficiently used to improve code maintainance.
-
Structured serialization: how to make your serialized stucture stable ?
We saw in previous article that Flexo allows object graph serialization. We saw that in some cases, serialization results are not really human-readable. Furthermore, in the context of concurrent modifications (CVS context), conflicts resolution is difficult as serialized structure is not stable. This document deals with a way to ensume stable serialized structure.
-
How to make identifier persistant when coding object graph structure ?
When trying to work in a collaborative context, some problems may arise because identifiers used by XMLCoDe may change (and be unstable) as they are internally allocated by XMLCoDe. This document explains how to resolve this problem by using custom identifiers, which might be stable in time.
-
You may also want to browse JavaDoc API documentation
This distribution
The binary distribution is released as a jar file containing classes defined in fr.enstb.xmlcode package (contains XMLCoder, XMLDecoder and XMLMapping classes).
If your Java environment does not contain DOM-model nor JDOM-model, you might want to use following provided jars crimson.jar (see http://xml.apache.org/crimson/ and http://www.w3.org/DOM/) and jdom-1.0.jar (see http://www.jdom.org/)
To run examples you also may need JUnit library, also available with this software here: junit-3.8.1.jar.
The source distribution contains all the sources. You need JDK to compile it. This source distribution contains also some examples.
The API documentation contains the Javadoc for XMLCoDe.
-
Download the source distribution xmlcode-1.0-src.tar.gz
-
Download the binary distribution xmlcode-1.0.jar
-
Download Sax Parser jar crimson.jar
-
Download JDom library library jar jdom-1.0.jar
-
Download JUnit library jar junit-3.8.1.jar
-
Download the javadoc api xmlcode-1.0-api-doc.tar.gz
-
Consult the JavaDoc API
Licensing issues
XMLCoDe project - A free java implementation of an XML coder/decoder
Copyright (C) 2001-2007 Sylvain Guerin
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Compilation
Compilation should be no problem (if you've downloaded the source and got a Java environment !) assuming that your JDK environment contains DOM and JDOM or that those libraries are present in your classpath.
If your Java environment does not contain DOM-model nor JDOM-model, you might want to use following provided jars crimson.jar (see http://xml.apache.org/crimson/ and http://www.w3.org/DOM/) and jdom-1.0.jar (see http://www.jdom.org/)
To run examples you also may need JUnit library, also available with this software here: junit-3.8.1.jar. (See http://www.jdom.org/).
Running examples
There are five examples contained in this distribution. They are located in the src/test/java/examples directory (example1, example2, example3, example4 and example5 directories).
Those examples are packaged as JUnit tests and assume that you've got JUnit library in your JDK environment.
Installation
To use this library, you just have to set you classpath variable in order to include xmlcode-1.0.jar.
If your Java environment does not contain DOM-model nor JDOM-model, don't forget to include following provided jars in your classpath crimson.jar and jdom-1.0.jar
Sylvain Guerin