private static void CheckForLockAttributes(string sectionName, XmlNode xmlNode) { XmlAttributeCollection attributes = xmlNode.Attributes; if (attributes != null) { foreach (XmlAttribute attribute in attributes) { if (ConfigurationElement.IsLockAttributeName(attribute.Name)) { throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_element_locking_not_supported", new object[] { sectionName }), attribute); } } } foreach (XmlNode node in xmlNode.ChildNodes) { if (xmlNode.NodeType == XmlNodeType.Element) { CheckForLockAttributes(sectionName, node); } } }
// Throw an exception if an attribute within a legacy section is one of our // reserved locking attributes. We do not want admins to think they can lock // an attribute or element within a legacy section. private static void CheckForLockAttributes(string sectionName, XmlNode xmlNode) { XmlAttributeCollection attributes = xmlNode.Attributes; if (attributes != null) { foreach (XmlAttribute attribute in attributes) { if (ConfigurationElement.IsLockAttributeName(attribute.Name)) { throw new ConfigurationErrorsException( SR.Format(SR.Config_element_locking_not_supported, sectionName), attribute); } } } foreach (XmlNode child in xmlNode.ChildNodes) { if (xmlNode.NodeType == XmlNodeType.Element) { CheckForLockAttributes(sectionName, child); } } }