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.
For the real XML element, the function calls directly the W3C DOM method:
Any error raised by this method will be reported by the function.org.w3c.dom.Element.setAttribute()
For all pseudo-element, except those of #STUB
type,
the function does nothing and only returns the attribute value.
(See also DSMElement.pseudoElement
property.)
You may use this function when you need to alter an XML document
dynamically in memory after it has been loaded from the file.
See also loadXMLDocument()
function.
Note: Changing the value of the attribute with
'xmlns'
name or whose name starts with
'xmlns:'
prefix will alter the list of
the namespace bindings associated with this element known to FlexDoc.
For instance, this will be reflected in the list of values returned
by '#DOCUMENT/@namespaces'
attribute.
Also, setting a new value to the 'xmlns'
attribute
will change the default namespace assumed by FlexDoc within that element.
Parameters:
element
setXMLAttribute(contextElement,attrName,value)
attrName
value
For the real XML element, the value is converted to string.
For #STUB
element, it is stored as object.
If the element contained no attribute with the specified name, the function returns empty string
(or null
, in case of #STUB
element).
removeXMLAttribute(), hasXMLAttribute(), getXMLAttribute(), loadXMLDocument()