--- E:\src\extern\nant-0.85-nightly-2005-06-09\src\NAnt.Core\TaskContainer.cs	Sun Jan 30 17:53:02 2005
+++ E:\src\extern\nant\src\NAnt.Core\TaskContainer.cs	Mon Jun 13 17:45:45 2005
@@ -27,6 +27,7 @@
 using NAnt.Core.Attributes;
 using NAnt.Core.Tasks;
 using NAnt.Core.Types;
+using NAnt.Core.Util;
 
 namespace NAnt.Core {
     /// <summary>
@@ -109,14 +110,37 @@
                     continue;
                 }
 
-                Task task = CreateChildTask(childNode);
-                // for now, we should assume null tasks are because of incomplete metadata about the XML.
-                if (task != null) {
-                    task.Parent = this;
-                    task.Execute();
-                }
+				if (TypeFactory.TaskBuilders.Contains(childNode.Name)) {
+					// create task instance
+					Task task = CreateChildTask(childNode);
+					// for now, we should assume null tasks are because of incomplete metadata about the XML.
+					if (task != null) {
+						task.Parent = this;
+						// execute task
+						task.Execute();
+					}
+				} 
+				else if (TypeFactory.DataTypeBuilders.Contains(childNode.Name)) {
+					// we are an datatype declaration
+					DataTypeBase dataType = CreateChildDataTypeBase(childNode);
+
+					Log(Level.Debug, "Adding a {0} reference with id '{1}'.", childNode.Name, dataType.ID);
+					if (! Project.DataTypeReferences.Contains(dataType.ID)) {
+						Project.DataTypeReferences.Add(dataType.ID, dataType);
+					} else {
+						Project.DataTypeReferences[dataType.ID] = dataType; // overwrite with the new reference.
+					}
+				} else {
+					throw new BuildException(string.Format(CultureInfo.InvariantCulture, 
+						ResourceUtils.GetString("NA1071"), childNode.Name), 
+						Project.LocationMap.GetLocation(childNode));
+				}
             }
         }
+	
+		protected virtual DataTypeBase CreateChildDataTypeBase(XmlNode node) {
+			return Project.CreateDataTypeBase(node);
+		}
 
         protected virtual Task CreateChildTask(XmlNode node) {
             return Project.CreateTask(node);
