/// <summary> Populates a Properties object with all <c><property></c> /// values defined as children of the specified node. Properties that already /// exist in the Properties object are optionally overwritten with properties /// defined by the node. /// /// </summary> /// <param name="props">The Properties object to populate /// </param> /// <param name="node">The XmlElement to search for child <c><property></c> elements /// </param> /// <param name="replace">true to replace the values of properties already defined /// in the <c>props</c> object /// </param> public virtual void PopulateProperties(IPropertyCollection props, XmlElement node, bool replace) { if (node != null) { XmlNodeList propertyList = node.SelectNodes(AdkXmlConstants.Property.ELEMENT); // Return only the "enabled" nodes foreach (XmlElement n in new XmlUtils.FilteredElementList(propertyList)) { string nam = n.GetAttribute(AdkXmlConstants.Property.NAME); string val = n.GetAttribute(AdkXmlConstants.Property.VALUE); if (nam.Length > 0 && val.Length > 0 && (replace || !props.Contains(nam))) { props[nam] = val; } } } }
/// <summary> Populates a Properties object with all <c><property></c> /// values defined as children of the specified node. Properties that already /// exist in the Properties object are optionally overwritten with properties /// defined by the node. /// /// </summary> /// <param name="props">The Properties object to populate /// </param> /// <param name="node">The XmlElement to search for child <c><property></c> elements /// </param> /// <param name="replace">true to replace the values of properties already defined /// in the <c>props</c> object /// </param> public virtual void PopulateProperties( IPropertyCollection props, XmlElement node, bool replace ) { if ( node != null ) { XmlNodeList propertyList = node.SelectNodes( AdkXmlConstants.Property.ELEMENT ); // Return only the "enabled" nodes foreach ( XmlElement n in new XmlUtils.FilteredElementList( propertyList ) ) { string nam = n.GetAttribute( AdkXmlConstants.Property.NAME ); string val = n.GetAttribute( AdkXmlConstants.Property.VALUE ); if ( nam.Length > 0 && val.Length > 0 && (replace || !props.Contains( nam )) ) { props[nam] = val; } } } }