Using Castor from Ant, how it can be done:
Use the ability of Ant to invoke a Java class. Set the arguments and
classpath
correct. Set the arguments:
-i for the input file (xsd)
-dest for the output sdestination
-f for suppression warning / requesting for user input (overwrite
existing
classes).
Set the classapth:
- a local directory (for inclusion of the file 'castorbuilder.properties')
- the classpath to castor.jar
- the classpath to xerces.jar (or other xml parser)
- the classpath to regexp.jar
Tip: First test if Ant can find Castor, remove the comment arround the
argument
'-h' and set comment arround the other two argument. This should print
the
Castor help info through Ant.
Warning: It is not possible to use properties in the castor arguments, they
are
not solved correct, path elements get mixed. At least this is my
experience. Let me know if there is a sollutioin for this.
Oke, a better way would even be to have a Castor task defined for Ant. Maybe
there is some time tomorrow to do that.
build.xml
----------------------------------------------------------------------------
----
<!-- ===================================================================
-->
<!-- Castor
-->
<!-- ===================================================================
-->
<target name="castor" depends="init">
<property name="dir.src.castor" value="${dir.src}/castor"
/>
<!--property name="dir.src.castor.xsd"
value="${dir.src.castor}/xsd" /-->
<property name="dir.src.castor.properties"
value="${dir.src.castor}/properties" />
<property name="dir.src.castor.xsd" value="${dir.src}/xsd"
/>
<echo message="${dir.src.castor}" />
<echo message="${dir.src.castor.xsd}" />
<echo message="${dir.src.castor.properties}" />
<java classname="org.exolab.castor.builder.SourceGenerator"
fork="true">
<!--arg value="-h" /-->
<arg value="-f" />
<arg value="-i=../../src/xsd/pims.xsd" />
<arg value="-dest=../../build/ant/src/java" />
<classpath>
<pathelement location="${dir.src.castor.properties}" />
<pathelement path="${package.castor.classpath}" />
<pathelement path="${package.xerces.classpath}" />
<pathelement path="${package.jakarta-regexp.classpath}" />
</classpath>
</java>
</target>
----------------------------------------------------------------------------
----
Tjeerd
This e-mail and any attachment is for authorised use by the intended recipient(s)
only. It may contain proprietary material, confidential information and/or be subject
to legal privilege. It should not be copied, disclosed to, retained or used by, any
other party. If you are not an intended recipient then please promptly delete this
e-mail and any attachment and all copies and inform the sender. Thank you.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev