Actually it is supported by Nant.
Suppose you have a task called <getarray> and you would like to write the task in the following way.
<getarray>
<!--Begin my array-->
<MyXMLTag>Value1</MyXMLTag>
<MyXMLTag>Value2</MyXMLTag>
<!--End my array-->
</getarray>
This document contains custom XML and the Task has to informed that this task has CustomXMLProcessing. You will have to override the CustomXmlProcessing property of the Task. You can then use the XmlNode property of the Task to access the entire XML Node and you can do custom processing with the same. I have attached a trivial code which simply echoes the items in the tag on the screen.
using System;
using System.Xml;
using NAnt.Core;
using Nant.Core.Attributes;
[TaskName("getarray")]
public class Class1 : NAnt.Core.Task
{
protected override bool
CustomXmlProcessing
{
{
get
{
return true;
}
}{
return true;
}
void
DisplayXML(XmlNode node)
{
{
foreach (XmlNode innernode in
node.SelectNodes("MyXMLTag"))
{
Log(Level.Info, innernode.InnerText);
}
}{
Log(Level.Info, innernode.InnerText);
}
protected override void
ExecuteTask()
{
}{
DisplayXML(this.XmlNode);
}It is not that straight forward but it is not very complex either. :-)
Regards,
Vagmi
On 7/13/06, Gary Feldman <[EMAIL PROTECTED]> wrote:
Cong wrote:
> Hi All,
>
> I need to pass an array of strings from the XML-base NAnt build file
> to my custom NAnt task. Can someone tell me which attribute I can use
> in the C# class for the custom task? And it will be very helpful if
> you could give me a simple XML example. Hope my question is clear.
Since NAnt doesn't really have arrays, why not just store them in their
own XML file and use standard .Net calls to get at them? You might want
to pass the filename, but that's easy.
>
> BTW, as a beginner, I feel there're too little help documents on how
> to use NAnt and how to create custom NAnt task. Is it because I
> haven't found them or this is the fact?
Creating custom tasks in C# isn't something I'd advise beginners to take
on.
Gary
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
--
http://geekswithblogs.net/vagmi.mudumbai
http://installneo.blogspot.com
"Peace is its own reward." - Mahatma Gandhi
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ NAnt-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nant-users
