private void LoadSchema(XDocument document, string fileName) { if (document.Root == null) { return; } var nodes = document.Root.Nodes(); foreach (var node in nodes) { if (node is XComment) { continue; } if (!(node is XElement element)) { continue; } if (element.Name.LocalName != "sectionSchema") { continue; } var name = element.Attribute("name")?.Value; var found = FindSectionSchema(name); if (found == null) { found = new SectionSchema(name, element, fileName); Debug.Assert(name != null, nameof(name) + " != null"); _sectionSchemas.Add(name, found); } found.ParseSectionSchema(element, null, fileName); } }
private void LoadSchema(XDocument document) { if (document.Root == null) { return; } var nodes = document.Root.Nodes(); foreach (var node in nodes) { if (node is XComment) { continue; } var element = node as XElement; if (element == null) { continue; } if (element.Name.LocalName != "sectionSchema") { continue; } var name = element.Attribute("name").Value; var found = FindSectionSchema(name); if (found == null) { found = new SectionSchema(name, element); _sectionSchemas.Add(name, found); } found.ParseSectionSchema(element, null); } }