Java
Approaches are based on the XML Schema:
JAXB and XMLBeans
JAXB - Eclipse Jakarta XML Binding provides an API and tools that automate the mapping between XML documents and Java objects.
Apache XMLBeans is a technology for accessing XML by binding it to Java types.
JAXB Generation - Windows Batch File
set JAXB_HOME=C:\Programs\jaxb\jaxb-ri-4.0.3\jaxb-ri
set XSD_HOME=..\..\model_based\xsd_variants
IF EXIST jaxb_42 RMDIR /S /Q jaxb_42
IF NOT EXIST jaxb_42 MKDIR jaxb_42
call %JAXB_HOME%\bin\xjc.bat -d jaxb_42 "%XSD_HOME%\ddi-cdi_42_noXsdTypeInName.xsd"
IF EXIST jaxb_43 RMDIR /S /Q jaxb_43
IF NOT EXIST jaxb_43 MKDIR jaxb_43
call %JAXB_HOME%\bin\xjc.bat -d jaxb_43 "%XSD_HOME%\ddi-cdi_43_noXsdTypeInName.xsd"
IF EXIST jaxb_44 RMDIR /S /Q jaxb_44
IF NOT EXIST jaxb_44 MKDIR jaxb_44
call %JAXB_HOME%\bin\xjc.bat -d jaxb_44 "%XSD_HOME%\ddi-cdi_44_noXsdTypeInName.xsd"
IF EXIST jaxb_45 RMDIR /S /Q jaxb_45
IF NOT EXIST jaxb_45 MKDIR jaxb_45
call %JAXB_HOME%\bin\xjc.bat -d jaxb_45 "%XSD_HOME%\ddi-cdi_45_noXsdTypeInName.xsd"
set JAXB_HOME=
set XSD_HOME=
Generation with XMLBeans - Ant Build File
<?xml version="1.0" encoding="UTF-8"?>
<project name="ddi-cdi-xmlbeans" default="create-xmlbeans">
<!-- xmlbeans location -->
<property name="xmlbeans.lib.dir" location="C:/Programs/xmlbeans-5.2.0/lib"/>
<!-- Set the classpath -->
<path id="build.classpath">
<fileset dir="${xmlbeans.lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="xmlbeans" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="${xmlbeans.lib.dir}/xmlbeans-5.2.0.jar" classpathref="build.classpath"/>
<!-- ddi-cdi schema -->
<property name="xsd_42" location="../../model_based/xsd_variants/ddi-cdi_42_noXsdTypeInName.xsd"/>
<property name="xsd_43" location="../../model_based/xsd_variants/ddi-cdi_43_noXsdTypeInName.xsd"/>
<property name="xsd_44" location="../../model_based/xsd_variants/ddi-cdi_44_noXsdTypeInName.xsd"/>
<property name="xsd_45" location="../../model_based/xsd_variants/ddi-cdi_45_noXsdTypeInName.xsd"/>
<target name="create-xmlbeans">
<xmlbeans schema="${xsd_42}" download="true" classpath="ddi-cdi-xmlbeans.jar" srconly="true" srcgendir="xmlbeans_42"/>
<xmlbeans schema="${xsd_43}" download="true" classpath="ddi-cdi-xmlbeans.jar" srconly="true" srcgendir="xmlbeans_43"/>
<xmlbeans schema="${xsd_44}" download="true" classpath="ddi-cdi-xmlbeans.jar" srconly="true" srcgendir="xmlbeans_44"/>
<xmlbeans schema="${xsd_45}" download="true" classpath="ddi-cdi-xmlbeans.jar" srconly="true" srcgendir="xmlbeans_45"/>
</target>
</project>
Evaluation
JAXB seems to be the better choice. XMLBeans doesn’t … (to be filled in)