Example 1: Default code generation

# Example 1: Default code generation |

JiBX Basics Overview Getting Started Binding Compiler Binding on Load Runtime Extras Building JiBX Contributing License News and Status Support FAQ Mailing Lists Bugs User Comments Sponsors Start from Code Start from Code BindGen Example Code Example 1 Example 2 Example 3 Example 4 Customizations Reference SchemaGen Jibx2Wsdl Examples Customizations Start from Schema Start from Schema CodeGen Example Code Example 1 Example 2 Example 3 Customizations Reference Binding Definition Binding Tutorial A basic binding Binding extras Structure mapping Collections and arrays Using mappings Advanced binding Method hooks Custom code Precompiled Bindings Definition details Definition contexts Conversions XML summary <binding> element <include> element <format> element <namespace> element <mapping> element <value> element <structure> element <collection> element Attribute groups Usage API Runtime JavaDocs Subprojects Eclipse Plug-in Introduction Install Usage Axis2 Usage | ### CodeGen default code generation You can use the Ant 'codegen' target to generate code from the schema using the CodeGen default settings. Here's the actual 'codegen' target from the build.xml:
      <!-- generate using default settings -->
      <target name="codegen" depends="check-runtime,clean">

        <echo message="Running code generation from schema"/>
        <java classname="org.jibx.schema.codegen.CodeGen" fork="yes"
            classpathref="classpath" failonerror="true">
          <arg value="-t"/>
          <arg value="gen/src"/>
          <arg value="otasubset/OTA_AirLowFareSearch*.xsd"/>
        </java>

      </target>
This passes the '-t' parameter to CodeGen with the value 'gen/src' to tell it the target generation directory. The third argument value tells CodeGen to use schemas from the otasubset directory with names matching the pattern "OTA_AirLowFareSearch*.xsd" as input for code generation. You can specify as many schema names or schema name patterns as you want when running CodeGen, but must have at least one - otherwise there's nothing for CodeGen to generate! ### Generated code Run the 'codegen' target and see the gen/src directory. You can also use the 'full' target to generate and compile the code, run the binding compiler, and finally run a supplied test program which roundtrips the sample documents from the samples directory. TODO: add discussion