private void Parse(XPathNavigator navigator, bool fromAppConfig) { XPathNavigator xpn = navigator.SelectSingleNode(XmlHelper.PropertiesExpression); if (xpn != null) { propertiesManager = new SimpleCfgPropertiesManager(navigator); } else { if (!fromAppConfig) { CfgException e = new CfgException("配置文件中没有发现标签<properties xmlns='" + XmlHelper.SchemaXmlns + "'>。"); throw e; } } }
private SimpleCfgRootManager(XmlReader configurationReader, bool fromAppSetting) { XPathNavigator nav; try { nav = new XPathDocument(XmlReader.Create(configurationReader, (new XmlSchemas()).CreateConfigReaderSettings())).CreateNavigator(); } catch (CfgException) { throw; } catch (Exception ex) { CfgException e = new CfgException("发生配置错误!", ex); throw e; } Parse(nav, fromAppSetting); }