/// <summary> /// Parse the NAnt build file. /// </summary> /// <param name="textReader">A TextReader from which to read /// the build file.</param> void ParseBuildFile(TextReader textReader) { XmlTextReader xmlReader = new XmlTextReader(textReader); try { ParseState state = ParseState.WaitingForProjectName; while (xmlReader.Read()) { if (state == ParseState.WaitingForProjectName) { if (IsProjectElement(xmlReader)) { ParseProjectElement(xmlReader); state = ParseState.WaitingForTargetName; } } else { if (IsTargetElement(xmlReader)) { ParseTargetElement(xmlReader); } } } } catch (XmlException ex) { buildFileError = new NAntBuildFileError(ex.Message, ex.LineNumber, ex.LinePosition); } finally { xmlReader.Close(); } }
/// <summary> /// Parse the NAnt build file. /// </summary> /// <param name="textReader">A TextReader from which to read /// the build file.</param> void ParseBuildFile(TextReader textReader) { XmlTextReader xmlReader = new XmlTextReader(textReader); try { ParseState state = ParseState.WaitingForProjectName; while(xmlReader.Read()) { if (state == ParseState.WaitingForProjectName) { if (IsProjectElement(xmlReader)) { ParseProjectElement(xmlReader); state = ParseState.WaitingForTargetName; } } else { if (IsTargetElement(xmlReader)) { ParseTargetElement(xmlReader); } } } } catch(XmlException ex) { buildFileError = new NAntBuildFileError(ex.Message, ex.LineNumber - 1, ex.LinePosition - 1); } finally { xmlReader.Close(); } }