internal Target (XmlElement targetElement, Project project, ImportedProject importedProject)
{
if (project == null)
throw new ArgumentNullException ("project");
if (targetElement == null)
throw new ArgumentNullException ("targetElement");
this.targetElement = targetElement;
this.name = targetElement.GetAttribute ("Name");
this.project = project;
this.engine = project.ParentEngine;
this.importedProject = importedProject;
this.onErrorElements = new List <XmlElement> ();
this.buildState = BuildState.NotStarted;
this.buildTasks = new List <BuildTask> ();
this.batchingImpl = new TargetBatchingImpl (project, this.targetElement);
bool onErrorFound = false;
foreach (XmlNode xn in targetElement.ChildNodes) {
if (xn is XmlElement) {
XmlElement xe = (XmlElement) xn;
if (xe.Name == "OnError") {
onErrorElements.Add (xe);
onErrorFound = true;
} else if (onErrorFound)
throw new InvalidProjectFileException (
"The element <OnError> must be last under element <Target>. Found element <Error> instead.");
else
buildTasks.Add (new BuildTask (xe, this));
}
}
}