ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <>
Subject Re: Exporting a Project Instance
Date Sat, 23 Mar 2002 15:35:58 GMT
On Saturday 23 March 2002 12:06, wrote:
> I have a code generator which produces a different number of Java classes
> based upon the input).  The names of these classes are also dependent on
> the input.  To make it that bit easier to work with the generated code I
> also
> generate a build.xml file.  I currently do this by hand crafting the XML
> using
> StringBuffer.append(...).  For example if I add a copy task to the
> project, I
> simply do something like:
> buff.append("<copy file=\"").append(sourceFileName).append("\"");
> buff.append(" tofile=\"").append(destFilename).append("\"");
> buff.append(" />\n");
> This is fine for the limited tasks I currently use.  I was thinking that
> in the
> future I may require to add other tasks and as such the amount of code I
> need
> to write increases.  The responses on this thread have been helpful and I
> now realise that my simplistic approach will not work.  The object model
> approach that Adam discussed seems to be the best way to achieve what
> I require.

A serialize-to-xml approach solves the problem of proper XML generation when 
used in this context. Simply create objects programatically then tell them to 
serialize. IMO, such a core would simplify the addition of new types of ant, 
since they could write their own XML by simply setting properties in the 
serialization stream.

-----  - -
"All them women gonna make me teach 'em what they don't know how. 
I'm going to Jackson." -- Johnny Cash

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message