Adds a new attribute to the specified element.
If an attribute with that name is already present in the element,
its value is changed to be that of the value
parameter.
This function is always guaranteed to work only with
custom elements, which are created using
CustomElement()
function.
The ordinary DSM (Data Source Model) elements that are connected to the external data source may not allow adding new attributes or changing the attribute values. That's because such attributes may be just virtual things maintained only by the DSM Type Driver via the calls to some external API. In such a case, using this function will lead to a DSM exception!
Currently, the only DSM Type Driver that allows changing attributes of the elements connected to the data source is XML DSM Driver, which works with XML files. This driver is a part of “DocFlex/XML” product. It does supports adding, removing or changing attributes, however, only for real XML element, not for special pseudo-elements maintained by the driver. |
Parameters:
element
Specifies the element whose attribute is to be added or changed.If not specified, the generator context element is assumed by default, which is the same as the call:
setAttr(contextElement, attrName, value)
attrName
The attribute name
value
The value to be assigned to the attribute.
Returns:
The value previous held by this attribute or null
,
if the element had no attribute with the specified name.
See Also:
getAttrValue(), hasAttr(), removeAttr(), CustomElement()