XmlExtensionsAddAttributes Method |
Adds the given list of attributes to the XML node. Adds the attributes in alphabetic order to maintain stability of order.
Namespace: CMS.HelpersAssembly: CMS.Helpers (in CMS.Helpers.dll) Version: 13.0.131
Syntax public static void AddAttributes(
this XmlElement node,
IDictionary attributes,
bool removeEmptyEntries = true
)
Parameters
- node
- Type: System.XmlXmlElement
XML node to add attributes to. - attributes
- Type: System.CollectionsIDictionary
Attributes to be added. - removeEmptyEntries (Optional)
- Type: SystemBoolean
If true, only attributes with non-empty value are added to the element.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
XmlElement. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Exception | Condition |
---|
ArgumentException | Some key of attributes is an empty string. |
ArgumentNullException | node is null. |
InvalidOperationException | Keys of attributes cannot be ordered. |
XmlException | Some key of attributes contains characters not suitable for an XML attribute name. |
See Also