/// <summary> /// Instantiates a <see cref="AssemblyConfiguration"/> /// </summary> public AssemblyConfiguration(string xml) { // load xml var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xml); // validate first child xmlDocument.FirstChild.ShouldBeNamed(RootName); // get different sections foreach (var childNode in xmlDocument.FirstChild.ChildNodes.OfType<XmlElement>()) { switch (childNode.Name) { case AssemblyConfigurationSettings.SettingsCollectionName: _settings = new AssemblyConfigurationSettings(childNode); break; case AssemblyConfigurationRegistrations.RegistrationsCollectionName: _registrations = new AssemblyConfigurationRegistrations(childNode); break; default: _customSections.Add(CreateCustomSection(childNode)); break; } } }
/// <summary> /// Instantiates a <see cref="AssemblyConfiguration"/> /// </summary> public AssemblyConfiguration(string xml) { // load xml var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xml); // validate first child xmlDocument.FirstChild.ShouldBeNamed(RootName); // get different sections foreach (var childNode in xmlDocument.FirstChild.ChildNodes.OfType <XmlElement>()) { switch (childNode.Name) { case AssemblyConfigurationSettings.SettingsCollectionName: _settings = new AssemblyConfigurationSettings(childNode); break; case AssemblyConfigurationRegistrations.RegistrationsCollectionName: _registrations = new AssemblyConfigurationRegistrations(childNode); break; default: _customSections.Add(CreateCustomSection(childNode)); break; } } }