Okay, I've spent more than two weeks working on this stuff and I have
digressed a little from my original goal(more than a week ago). So let
me get back to that.

I've built a task that generates XML Schema definitions for each task
that is loaded (by the TaskFactory). However, the schemas are incomplete
if I only use the information that is currently available from the NAnt
Attributes (classes derived from Attribute used to describe the XML
meaning of the build file and tasks).

Here are the basic problems with code attributes:

1.) Not everything is defined with NAnt Attributes. Take a look at
FileSet. The includes and excludes elements are read thought the
InitializeElement(XmlNode elementNode) method.

2.) BuildElementAttribute does not specify number of elements. There is
no way to tell how many elements are required.

3.) BuildElementAttribute requires that you derive your class from
Element. This is limiting and causes more of 1.

That leaves us two solutions (that I can think of). Either enhance the
code attributes or add code to supply this extra information.

Code Attributes 
Pros: Simple, Easy to use, intuitive?
Cons: Harder to extend, need to take into consideration each new code
attribute in core/framework, get much more complicated as the xml does.

XMLSchema Definition in Tasks
Pros: Once the framework is in place any type of xsd should be
supported, no need to change the core to support stuff
Cons: Might require XSD knowledge from the Task Developer (pretty bad!),
not as simple as code attributes 

This problem is really making me think hard about using the XML
Serialization Attributes. All of these problems have already been solved
there, and there is also support for XSD generation.

Thoughts?


Reply via email to