ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 14640] - Prototypical <jaxb> task to process XSD files using SUN's Jaxb Schema Compiler
Date Thu, 19 Jun 2003 18:37:52 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14640>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14640

Prototypical <jaxb> task to process XSD files using SUN's Jaxb Schema Compiler





------- Additional Comments From ddevienne@lgc.com  2003-06-19 18:37 -------
For reference, this is how the task is used by our build:

  <!-- ====================================================
       Generates the Jaxb-generated Java code from XML schemas (XSDs)

       This task will not regenerate the Java code from the schemas if the
       schema is not more recent the files in the target package/directory,
       or if this target package/directory as not been modified in any way.
       Otherwise, the target package/directory will be deleted,
       and regeneration of the Java code will occur.

       By default, the target package is deduced from the location of the
       schema, in a generated sub-package with further a sub-package named
       after the schema short filename (lower-cased).

       For example, schema com/lgc/infra/acme/tools.xsd
       yields package name com.lgc.infra.acme.generated.tools

       Schema filenames yielding invalid package name fragments
       will cause build exceptions... For example, schema-1.xsd
       or schema#1.xsd or 1schema.xsd are all invalid!

       But one can define a mapper to custom-deduce the package name to
       generate the Java code into, as shown in the target below.
    -->
  <target name="generated"
          description="Generates (using Jaxb) Java code from XML schemas">
    <jaxb destDir="${src}"
          readOnly="true"
          strictValidation="true"
          xjcjar="tools/jwsdp-1.1/jaxb-1.0/lib/jaxb-xjc.jar">
      <schemas dir="${src}" includes="**/doc-files/*.xsd" />

      <!-- Custom mapper to deduce the target package name:
           For example, schema com/lgc/infra/acme/doc-files/tools.xsd
           yields package name com.lgc.infra.acme.generated.tools
        -->
      <targetPackageMapper type="regexp"
                           from="(.*)/doc-files/(.*)\.xsd"
                           to="\1/generated/\2" />
    </jaxb>
  </target>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message