SET-ATTRIBUTE( ) method Adds a new attribute to an element. If an attribute with the same name is already present, its value is replaced with the specified value. Return type: LOGICAL Applies to: X-noderef object handle Syntax SET-ATTRIBUTE ( name , value ) name A character expression that represents the attribute name. value A character expression that represents the attribute value. The following example creates the following line in the hDoc output .xml file: <Customer Id="54" Name="Second Skin Scuba"/> CREATE X-DOCUMENT hDoc. CREATE X-NODEREF hRoot. CREATE X-NODEREF hNoderef. hDoc:CREATE-NODE(hRoot,"root","ELEMENT"). hDoc:APPEND-CHILD(hRoot). ... hDoc:CREATE-NODE(hNoderef,"Customer","ELEMENT"). hNoderef:SET-ATTRIBUTE("Id","54"). hNoderef:SET-ATTRIBUTE("Name","Second Skin Scuba"). hRoot:APPEND-CHILD(hNoderef).
SET-ATTRIBUTE ( name , value )
CREATE X-DOCUMENT hDoc.
CREATE X-NODEREF hRoot.
CREATE X-NODEREF hNoderef.
hDoc:CREATE-NODE(hRoot,"root","ELEMENT").
hDoc:APPEND-CHILD(hRoot).
...
hDoc:CREATE-NODE(hNoderef,"Customer","ELEMENT").
hNoderef:SET-ATTRIBUTE("Id","54").
hNoderef:SET-ATTRIBUTE("Name","Second Skin Scuba").
hRoot:APPEND-CHILD(hNoderef).