xml serialization generator for java without using reflection

Asked by on 2012-01-23T04:52:03-05:00
Is there an XML serialization framework for Java that does not use reflection, but instead generates static serialization code (Java source) from XSD ?

Best Answer

Answered by on 2012-01-23T15:56:27-05:00
I've never seen anything that does exactly what you are asking for: generating serialization code from XSD. However, if you're not stuck with an existing XSD schema, http://modello.codehaus.org/index.html may satisfy your requirements.

Modello is used by Maven for parsing pom.xml and settings.xml files. It reads a .mdo file (like http://svn.apache.org/repos/asf/maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo of the Maven project model), and can generate a Java object model; an XML Schema (XSD) file; and serialisation/de-serialisation code. The serialisation/deserialisation code can use one of a number of XML parser APIs (e.g. JDOM, StAX, etc.). The XML parser API used by Maven itself is xpp3.

Modello can also generate code to convert one version of the model to another. It can generate HTML documentation about your XML format.

If you have an existing XSD, it might be too much work to use modello. But, if you're creating your own XML format, it could be worth starting with modello and generating the XSD.

Your Answer
No advertising and No spamming please.
Name:
Answer: