----- Original Message -----
From: "Shackelford, John-Mason" <[EMAIL PROTECTED]>
To: "'Ant Developers List'" <[EMAIL PROTECTED]>
Sent: Wednesday, September 11, 2002 10:15 AM
Subject: RE: handling external resources
> Craeg,
>
> > Our requirements are quite different, but I bet there is a
> > design for an <xmldatatype> that could satisfy both requirements.
>
> Probably what you need would be a layer underneith what I am looking
> for, but it perhaps it is the best place to start.
>
> > That way you could grab the value of a node out of it using an
> > XPath expression. Is that what you were thinking? That would be
> > very useful IMHO.
>
> Wow, that would certainly give you a great deal of flexibility!
> What I want to be able to do is manipulate pieces of an XML doc
> as objects, but perhaps having the capability you speak of needs
> to be in place first.
>
> I wish JAXB were further along. Has anyone played with it in an Ant
> context? The short section on JAXB in "Java Development with Ant" is
> tantalizing.
>
We mentioned castor too, but didnt show you how to use it from ant. You need
to call the program with <java>, do your own availability and up to date
tests:
<target name="check-castor" depends="init">
<available property="payload.xsd.found" file="${payload.xsd}" />
<available property="settings.xsd.found" file="${settings.xsd}" />
<available property="users.xsd.found" file="${users.xsd}" />
<fail unless="payload.xsd.found">Can not find ${payload.xsd}</fail>
<fail unless="settings.xsd.found">Can not find ${settings.xsd}</fail>
<fail unless="users.xsd.found">Can not find ${users.xsd}</fail>
<uptodate property="castor.uptodate"
targetfile="${castor.touchfile}">
<srcfiles dir="${dtd.dir}" includes="**/*.xsd"/>
</uptodate>
</target>
<target name="castor" depends="check-castor" unless="castor.uptodate">
<property name="castor.generator"
value="org.exolab.castor.builder.SourceGenerator"/>
<echo >Processing ${payload.xsd}</echo>
<java classname="${castor.generator}"
fork="true"
failonerror="true"
classpathref="castor.execute.path">
<arg value="-i"/>
<arg file="${payload.xsd}"/>
<arg value="-package"/>
<arg value="${castor.package}.jobticket"/>
<arg value="-dest"/>
<arg file="${castor.src.dir}"/>
<arg value="-types"/>
<arg value="j2"/>
<arg value="-f"/>
</java>
<echo >Processing ${users.xsd}</echo>
<java classname="${castor.generator}"
fork="true"
failonerror="true"
classpathref="castor.execute.path">
<arg value="-i"/>
<arg file="${users.xsd}"/>
<arg value="-package"/>
<arg value="${castor.package}.conf"/>
<arg value="-dest"/>
<arg file="${castor.src.dir}"/>
<arg value="-types"/>
<arg value="j2"/>
<arg value="-f"/>
</java>
<echo >Processing ${settings.xsd}</echo>
<java classname="${castor.generator}"
fork="true"
failonerror="true"
classpathref="castor.execute.path">
<arg value="-i"/>
<arg file="${settings.xsd}"/>
<arg value="-package"/>
<arg value="${castor.package}.conf"/>
<arg value="-dest"/>
<arg file="${castor.src.dir}"/>
<arg value="-types"/>
<arg value="j2"/>
<arg value="-f"/>
</java>
<touch file="${castor.touchfile}"/>
</target>
Note that a missing XSD causes castor to print 'no schema' but not fail with
an error, hence the available probes and fails.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>