DynamicDOM v0.43.2. Implementation based on XRules v0.43

XmlHelpers.SetAttribute Method 

Sets the value of the given attribute If an attribute with the given name does not exist and the 'value' parameter is not null, the attribute will be created. If an attribute with the given name already exists, but the 'value' parameter is null, the attribute will be removed.

[Visual Basic]
Shared Public Function SetAttribute( _ 
   ByVal element As XmlElement, _ 
   ByVal name As String, _ 
   ByVal value As String _ 
) As XmlAttribute
[C#]
public static XmlAttribute SetAttribute(
   XmlElement element,
   string name,
   string value
);
[C++]
public: static XmlAttribute* SetAttribute(
   XmlElement* element,
   String* name,
   String* value
);
[JScript]
public static function SetAttribute(
   XmlElement element,
   String name,
   String value
): XmlAttribute;

Parameters

element
The XML element to add the attribute to. This should not be null.
name
A string containing the name of the attribute. This should not be null or empty string.
value
A string containing the value of the attribute. If this value is null, the attribute will not be added, and will be removed if it already exists in the element.

Return Value

Returns a reference to the attribute or null if the 'value' parameter is null.

See Also

XmlHelpers Class | XRules.Utilities Namespace