This sounds interesting. Maybe we would want to introduce some xpathselection elements to replace your property example. Properties in this example would probably be a little confusing to the user since it isn't really a regular property (the value is retrieved via xpath, not only via an expression).
<xmlforeach file="" xpath=""> <xmlselect propertyname="" xpath="@attribute"> <xmlselect propertyname="" xpath="node"> <xmlselect propertyname="" xpath="text()"> <xmlselect propertyname="" xpath="child/@attribute"> <do> ... </do> </xmlforeach> It would be really cool if we make this work so that you could use the <xmlpeek/> task to select from the open file (xmldocument). Then later when if/when we get referencable types (for example an xml file factory or something) we could just a little more efficient. It would be nice to use the implied context here to simplify things. ;) <foreach /> could also be updated but this probably falls out of the scope of that. This is pretty specialized, and will need to be very specific to xml. ----- Original Message ----- From: "Matthew Mastracci" <[EMAIL PROTECTED]> To: "Nant-Developers (E-mail)" <[EMAIL PROTECTED]> Sent: Thursday, December 18, 2003 12:25 PM Subject: [nant-dev] Adding XML support to <foreach> or new task > I'm looking at adding XML iteration support for either the <foreach> > task or perhaps a new, yet-unnamed task. I would like to be able to > iterate over a file based on an XPath query, picking up each matching > element or attribute in turn. <foreach> is the easiest place to add it, > but it's not really a clean solution. > > A better way would be to model a new <xmlforeach> task on the existing > xmlpeek/xmlpoke tasks like so: > > <xmlforeach file="foo.xml" xpath="/configuration/blahelement"> > <property name="someattribute" value="@attribute" /> > <property name="someinnertext" value="text()" /> > <do> > <echo>${someattribute}, ${someinnertext}</echo> > </do> > </xmlforeach> > > How does this sound? ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers