public void ProcessCustomAttributes() { var customAttributes = XmlLayoutUtilities.GetGroupedCustomAttributeNames(); foreach (var group in customAttributes) { var existingAttributes = GetAttributeGroup(group.Key); foreach (var attributeName in group.Value) { var _attributeName = Char.ToLower(attributeName[0]) + attributeName.Substring(1); var attribute = XmlLayoutUtilities.GetCustomAttribute(attributeName); if (attribute.RestrictToPermittedElementsOnly) { // add attribute to permitted elements foreach (var element in attribute.PermittedElements) { if (!customAttributesToAddByElement.ContainsKey(element)) { customAttributesToAddByElement.Add(element, new Dictionary <string, CustomXmlAttribute>()); } customAttributesToAddByElement[element].Add(_attributeName, attribute); } } else if (!existingAttributes.Contains(attributeName, StringComparer.OrdinalIgnoreCase)) { // add attribute to group if (!customAttributesToAddByGroup.ContainsKey(group.Key)) { customAttributesToAddByGroup.Add(group.Key, new Dictionary <string, CustomXmlAttribute>()); } customAttributesToAddByGroup[group.Key].Add(_attributeName, attribute); } } } }
public void ProcessCustomAttributes() { var customAttributes = XmlLayoutUtilities.GetGroupedCustomAttributeNames(); foreach (var group in customAttributes) { var existingAttributes = GetAttributeGroup(group.Key); foreach (var attribute in group.Value) { if (!existingAttributes.Contains(attribute, StringComparer.OrdinalIgnoreCase)) { if (!customAttributesToAdd.ContainsKey(group.Key)) { customAttributesToAdd.Add(group.Key, new Dictionary <string, CustomXmlAttribute>()); } customAttributesToAdd[group.Key].Add(Char.ToLower(attribute[0]) + attribute.Substring(1), XmlLayoutUtilities.GetCustomAttribute(attribute)); } } } }