It looks like a lot of places in the NAnt code use commas to separate multiple values. Perhaps:

<foreach item="Line" in="C:\foo.txt" delim="," property="x,y">

?

Scott Hernandez wrote:

+1 on delim.

I don't think xml lets you have multiple attributes of the same name in the
same element. I'm fine with the idea of multiple properties per line, but
what would be a natural way to express this in valid xml?

----- Original Message -----
From: "Matthew Mastracci" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 27, 2003 12:55 PM
Subject: [nant-dev] Loop task delimiters




Should we change the following lines in the LoopTask?  Currently, the
string is split based on a single delimiter.  Since String.Split()
supports a character array, we can remove the char array [0] indexer and
have it split on any character in the "delim" property.  I can fix this
and check it in, if noone objects:

case ItemTypes.String: {
if(Delimiter != null && Delimiter.Length > 0) {
string[] items =


_source.Split(Delimiter.ToCharArray()[0]);


foreach(string s in items)
DoWork(s);
}
else
throw new BuildException("Invalid delim: " +


_delim, Location);


                       break;
                   }

becomes:

case ItemTypes.String: {
if(Delimiter != null && Delimiter.Length > 0) {
string[] items =


_source.Split(Delimiter.ToCharArray());


foreach(string s in items)
DoWork(s);
}
else
throw new BuildException("Invalid delim: " +


_delim, Location);


                       break;
                   }

It would also be nice if we could support delim and multiple properties
for the foreach item="line" task to parse a file with (potentially)
multiple items per line.  Something along the lines of:

<foreach item="Line" in="C:\foo.txt" delim="," property="x" property="y">
 <echo message="copying ${x} to ${y}"/>
 ...
</foreach>

How does this sound?










-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to