ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Transforming a text file line by line with ant.
Date Tue, 04 May 2010 08:02:16 GMT
On 2010-05-04, Marco Faustinelli <marco_faustinelli@yahoo.com> wrote:

> I have to write an xml file from a csv file inside an ant script. The
> way the csv lines are transformed depends on a very much complex
> choice, so using XSLT is excluded. Please just trust me on this one.

> My idea would be to split the csv files into lines and process each
> line using a class which extends ProjectComponent and implements
> TokenFilter.Filter.

Sounds right.

> I have seen yesterday that filters can be called more than once per
> line,

They can?  Yesterday we talked about mappers acting on file names.
filters shouldn't be invoked multiple times.  In which situation do you
see such a behavior?

> ...Is this feasible and reliable, or is it just trying to fix a square
> peg in a round hole?

No, filters are exactly what you want to use.  You may need to throw in
additional classes into your filterchain that will ensure you get the
correct root element and closing tag (likely ConcatFilter will do), but
this is exactly the right extension point in Ant for a task like this.

Stefan

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


Mime
View raw message