That's much better.

<target name="test">
   <for param="line">
      <FileLineIterator file="test_list.txt"/>

      <sequential>
         <propertyregex property="source"
                        input="@{line}"
                        regexp="^([^ ]*).*"
                        select="\1"
         />

         <propertyregex property="target"
                        input="@{line}"
                        regexp="^(.+)\s(.+)$"
                        select="\2"
         />

         <property name="target" value="${source}"/>

         <echo>Process Source=${source} Target=${target}</echo>

         <var name="source" unset="true"/>
         <var name="target" unset="true"/>
      </sequential>
   </for>
</target>

-----Original Message-----
From: Matt Benson [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 11, 2005 5:19 PM
To: Ant Users List
Subject: RE: Parsing file. It works but...


--- Matt Benson <[EMAIL PROTECTED]> wrote:

> --- "Dick, Brian E." <[EMAIL PROTECTED]> wrote:
> 
> > That's a bit better.
> > 
> > Is there a better way to iterate the lines in the
> > file? The <for> task
> > docs say any type that has a public iterator() can
> > be used. Is there
> > such a type for file iteration?
> 
> There is now.

To clarify, this class implements Iterator directly
'cause I couldn't think of a good name for something
to return such an iterator.  But since for will accept
an iterator directly, it's just as good.  I have
actually tested this and it works for me.

-Matt

> 
> HTH,
> Matt
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> Meet the all-new My Yahoo! - Try it today! 
> http://my.yahoo.com 
>  
> 
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to