om.DomNode.setAttribute

Sets the value of a DOM node attribute.

Syntax

setAttribute(
   name STRING,
   value STRING )
  1. name is the name of the attribute.
  2. value is the attribute value.

Usage

The setAttribute() method sets the value of an attribute in the current node.

DOM node attribute names are case-sensitive.

Note: Make sure that the strings passed to the method do not contain illegal XML characters. Illegal XML characters will be silently ignored. Illegal XML characters are any character below space (ASCII 32), except \r (ASCII 13), \n (ASCII 10) and \t (ASCII 9).

For character nodes (created for example with the createChars() of a DomDocument object), you can set the text value by passing the @chars attribute name to the method.

Example

DEFINE node om.DomNode
...
CALL node.setAttribute("name", "tiger")

For a complete example, see Example 1: Creating a DOM tree.