ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Faustinelli <marco_faustine...@yahoo.com>
Subject Transforming a text file line by line with ant.
Date Tue, 04 May 2010 06:08:37 GMT
Good morning,
I wish I could have some expert opinion on the following topic.

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.

This class would be placed in a filterchain, would process the csv line and append the transformed
output to a StringBuffer or send it to an OutputStream.

I have seen yesterday that filters can be called more than once per line, so I believe I have
to put in place some mechanism for making sure to write only once to the output. I could do
that, but...

...Is this feasible and reliable, or is it just trying to fix a square peg in a round hole?
Is there a better way of doing this in the ant toolbox? Thanks in advance.

Have a nice day,
Marco Faustinelli

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message