> Could someone go into a little more detail here? (I'm a 
> little knew to nant and trying to catch up :)
> 
> 
> -----Original Message-----
> From: Gerry Shaw
>  > Why not have the element class have a default 
> implementation based on
> 
> > the Attributes and if a task chooses to override this for
> > some reason it can.


Provide a virtual method in the Element class that can create the schema
for that element.  This implementation would simply use [attributes]
attached to the class to determine the required xml attributes and xml
child elements.  Classes that inherit from Element could then override
this method and perform more sophisticated validation.

This would let for example the <touch> [1] to replace the basic runtime
syntax error check with something in the schema that would flag this
type of error before the build even started.

Other tasks like the <sleep> [2] wouldn't be able to take advantage of
this as the only time you know about the contents of the attribute is at
runtime due to macro exapansion.  This isn't a problem because the
[validator] attributes normally catch most of these errors (in fact the
<sleep> task should have a number of [IntValidator] attributes attached
:)

[1]
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nant/nant/src/NAnt/Tasks/
TouchTask.cs?rev=HEAD&content-type=text/vnd.viewcvs-markup

[2]
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nant/nant/src/NAnt/Tasks/
SleepTask.cs?rev=HEAD&content-type=text/vnd.viewcvs-markup





_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to