Jan, Thanks for the help.
Following your suggestion, this is what I have: public class MyTask extends Task { private String a; private String b; private List<String> things = new ArrayList<String>(); public void execute() { for (String t : things) System.out.println (t) } public void addThings(Things thing) { for (Thing t : things.getThings()) this.things.add(f.getName()); } public class Things extends DataType { private List<Thing> things = new ArrayList<Thing>(); public List<Thing> getThings() { return things; } public void addThing (Thing f) { things.add(f); } } public class Thing extends DataType { private String name; public void addText(String name) { Project p = getProject(); this.name = p.replaceProperties(name); } public String getName() { return name; } } } When I used the task, it gives me: MyTask doesn't support the nested "thing" element. Not sure why. Thanks. David Jan.Materne wrote: > > You have several things: > - add <things> to <mytask> > class MyTask extends Task { addThings(Things t) > - add <thing> to <things> > class Things extends DataType { addThing(Thing t) > - add text to <thing> > class Thing extends DataType { addText(String t) > > > For documentation: > * Tutorial about writing tasks > http://ant.apache.org/manual/tutorials.html > addText: > http://ant.apache.org/manual/tutorial-writing-tasks.html#NestedText > * Source code of Ant > > http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/ > > > Jan > > >>-----Ursprüngliche Nachricht----- >>Von: scabbage [mailto:guans...@gmail.com] >>Gesendet: Donnerstag, 4. Februar 2010 22:41 >>An: user@ant.apache.org >>Betreff: Question about simple nested text elements >> >> >>I'm trying to create my own customized task in Ant 1.7.1. I >>would like to use >>my task this way: >> >><mytask a="blah" b="foo"> >> <things> >> <thing>xxx</thing> >> <thing>yyy</thing> >> <thing>zzz</thing> >> </things> >></mytask> >> >>My class looks like: >> >>public class MyTask extends Task { >> private String a; >> private String b; >> private List<String> things = new ArrayList<String>(); >> >> // setting and gettings for a and b ... >> >> public void execute() { >> // loop through things >> } >> >>} >> >>Now can anyone tell me how I should right the setter for >>"things"? The Ant >>doc is very vague about simple nested text elements. >> >>Thanks. >> >>David >>-- >>View this message in context: >>http://old.nabble.com/Question-about-simple-nested-text-element > s-tp27460186p27460186.html >>Sent from the Ant - Users mailing list archive at Nabble.com. >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: user-unsubscr...@ant.apache.org >>For additional commands, e-mail: user-h...@ant.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > > > -- View this message in context: http://old.nabble.com/Question-about-simple-nested-text-elements-tp27460186p27475451.html Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org