void LoadFromXml(MSBuildXmlReader reader) { AssertCanModify(); DisposeMainInstance(); ChildNodes = ChildNodes.Clear(); conditionedProperties = new ConditionedPropertyCollection(); bestGroups = null; hadXmlDeclaration = false; initialWhitespace = null; StartInnerWhitespace = null; while (!reader.EOF && reader.NodeType != XmlNodeType.Element) { if (reader.NodeType == XmlNodeType.XmlDeclaration) { initialWhitespace = reader.ConsumeWhitespace(); hadXmlDeclaration = true; reader.Read(); } else if (reader.IsWhitespace) { reader.ReadAndStoreWhitespace(); } else { reader.Read(); } } if (reader.EOF) { return; } Read(reader); while (!reader.EOF) { if (reader.IsWhitespace) { reader.ReadAndStoreWhitespace(); } else { reader.Read(); } } }
internal override void Read (MSBuildXmlReader reader) { if (reader.ForEvaluation) reader.Read (); else base.Read (reader); }
internal override void ReadChildElement(MSBuildXmlReader reader) { MSBuildObject ob = null; switch (reader.LocalName) { case "ItemGroup": ob = new MSBuildItemGroup(); break; case "PropertyGroup": ob = new MSBuildPropertyGroup(); break; case "ImportGroup": ob = new MSBuildImportGroup(); break; case "Choose": ob = new MSBuildChoose(); break; default: ob = new MSBuildXmlElement(); break; } if (ob != null) { ob.ParentNode = this; ob.Read(reader); ChildNodes = ChildNodes.Add(ob); } else { reader.Read(); } }
internal override void Read(MSBuildXmlReader reader) { if (reader.ForEvaluation) { reader.Read(); } else { base.Read(reader); } }
internal override void Read(MSBuildXmlReader reader) { StartWhitespace = reader.ConsumeWhitespace(); Value = reader.Value; reader.Read(); while (reader.IsWhitespace) { reader.ReadAndStoreWhitespace(); } EndWhitespace = reader.ConsumeWhitespaceUntilNewLine(); }
internal virtual void ReadContent (MSBuildXmlReader reader) { if (reader.IsEmptyElement) { reader.Skip (); return; } var elemName = reader.LocalName; reader.Read (); bool childFound = false; while (reader.NodeType != XmlNodeType.EndElement) { if (reader.NodeType == XmlNodeType.Element) { if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine (); } ReadChildElement (reader); } else if (reader.NodeType == XmlNodeType.Text) { if (!SupportsTextContent) throw new MSBuildFileFormatException ("Text content is not allowed inside a " + elemName + " element"); if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine (); } var tn = new MSBuildXmlTextNode (); tn.Read (reader); ChildNodes = ChildNodes.Add (tn); } else if (reader.NodeType == XmlNodeType.CDATA) { if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine (); } var tn = new MSBuildXmlCDataNode (); tn.Read (reader); ChildNodes = ChildNodes.Add (tn); } else if (reader.NodeType == XmlNodeType.Comment) { if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine (); } var tn = new MSBuildXmlCommentNode (); tn.Read (reader); ChildNodes = ChildNodes.Add (tn); } else if (reader.IsWhitespace) { reader.ReadAndStoreWhitespace (); } else if (reader.EOF) throw new InvalidOperationException ("Invalid XML"); else reader.Read (); } reader.Read (); EndInnerWhitespace = reader.ConsumeWhitespace (); }
void LoadFromXml (MSBuildXmlReader reader) { AssertCanModify (); DisposeMainInstance (); ChildNodes = ChildNodes.Clear (); conditionedProperties = new ConditionedPropertyCollection (); bestGroups = null; hadXmlDeclaration = false; initialWhitespace = null; StartInnerWhitespace = null; while (!reader.EOF && reader.NodeType != XmlNodeType.Element) { if (reader.NodeType == XmlNodeType.XmlDeclaration) { initialWhitespace = reader.ConsumeWhitespace (); hadXmlDeclaration = true; reader.Read (); } else if (reader.IsWhitespace) reader.ReadAndStoreWhitespace (); else reader.Read (); } if (reader.EOF) return; Read (reader); while (!reader.EOF) { if (reader.IsWhitespace) reader.ReadAndStoreWhitespace (); else reader.Read (); } }
internal override void ReadChildElement (MSBuildXmlReader reader) { MSBuildObject ob = null; switch (reader.LocalName) { case "ItemGroup": ob = new MSBuildItemGroup (); break; case "PropertyGroup": ob = new MSBuildPropertyGroup (); break; case "ImportGroup": ob = new MSBuildImportGroup (); break; case "Choose": ob = new MSBuildChoose (); break; default: ob = new MSBuildXmlElement (); break; } if (ob != null) { ob.ParentNode = this; ob.Read (reader); ChildNodes = ChildNodes.Add (ob); } else reader.Read (); }
internal virtual void ReadContent(MSBuildXmlReader reader) { if (reader.IsEmptyElement) { reader.Skip(); return; } var elemName = reader.LocalName; reader.Read(); bool childFound = false; while (reader.NodeType != XmlNodeType.EndElement) { if (reader.NodeType == XmlNodeType.Element) { if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine(); } ReadChildElement(reader); } else if (reader.NodeType == XmlNodeType.Text) { if (!SupportsTextContent) { throw new MSBuildFileFormatException("Text content is not allowed inside a " + elemName + " element"); } if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine(); } var tn = new MSBuildXmlTextNode(); tn.Read(reader); ChildNodes = ChildNodes.Add(tn); } else if (reader.NodeType == XmlNodeType.CDATA) { if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine(); } var tn = new MSBuildXmlCDataNode(); tn.Read(reader); ChildNodes = ChildNodes.Add(tn); } else if (reader.NodeType == XmlNodeType.Comment) { if (!childFound) { childFound = true; StartInnerWhitespace = reader.ConsumeWhitespaceUntilNewLine(); } var tn = new MSBuildXmlCommentNode(); tn.Read(reader); ChildNodes = ChildNodes.Add(tn); } else if (reader.IsWhitespace) { reader.ReadAndStoreWhitespace(); } else if (reader.EOF) { throw new InvalidOperationException("Invalid XML"); } else { reader.Read(); } } reader.Read(); EndInnerWhitespace = reader.ConsumeWhitespace(); }
internal override void Read (MSBuildXmlReader reader) { StartWhitespace = reader.ConsumeWhitespace (); Value = reader.Value; reader.Read (); while (reader.IsWhitespace) reader.ReadAndStoreWhitespace (); EndWhitespace = reader.ConsumeWhitespaceUntilNewLine (); }