private void ReadXml(XmlReader reader) { if (ViewSpecs != null) { throw new ReadOnlyException(); } if (reader.IsEmptyElement) { ViewSpecs = ImmutableList.Empty <ViewSpec>(); reader.ReadElementString("views"); // Not L10N return; } reader.Read(); var viewItems = new List <ViewSpec>(); while (true) { if (reader.IsStartElement("view")) // Not L10N { viewItems.Add(ViewSpec.ReadXml(reader)); } else if (reader.NodeType == XmlNodeType.EndElement) { reader.ReadEndElement(); break; } else { reader.Read(); } } ViewSpecs = ImmutableList.ValueOf(viewItems); }
public void ReadXml(XmlReader reader) { Name = reader.GetAttribute("name"); if (reader.IsEmptyElement) { reader.ReadElementString("views"); return; } reader.Read(); var viewSpecs = new List <ViewSpec>(); while (true) { if (reader.IsStartElement("view")) { viewSpecs.Add(ViewSpec.ReadXml(reader)); } else if (reader.NodeType == XmlNodeType.EndElement) { reader.ReadEndElement(); break; } else { reader.Read(); } } ViewSpecs = viewSpecs.AsReadOnly(); }
private void ReadXml(XmlReader reader) { if (Views != null) { throw new ReadOnlyException(); } if (reader.IsEmptyElement) { ViewSpecLayouts = ImmutableList.Empty <ViewSpecLayout>(); reader.ReadElementString(@"views"); return; } reader.Read(); var viewItems = new List <ViewSpec>(); var layouts = new List <ViewLayoutList>(); while (true) { if (reader.IsStartElement(@"view")) { viewItems.Add(ViewSpec.ReadXml(reader)); } else if (reader.IsStartElement(@"layouts")) { layouts.Add(ViewLayoutList.ReadXml(reader)); } else if (reader.NodeType == XmlNodeType.EndElement) { reader.ReadEndElement(); break; } else { reader.Skip(); } } ViewSpecLayouts = ImmutableList.ValueOf(MakeViewSpecLayouts(viewItems, layouts)); }