DOM SET XML ATTRIBUTE

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11 (Modified)


DOM SET XML ATTRIBUTE (elementRef; attrName; attrValue{; attrName2; attrValue2; ...; attrNameN; attrValueN})

ParameterTypeDescription
elementRefStringXML element reference
attrNameStringAttribute to set
attrValueString | ValueNew attribute value

Description

The DOM SET XML ATTRIBUTE command allows adding one or more attributes to the XML element whose reference is passed in the elementRef parameter. It also allows setting the value of each attribute defined.

Pass the attriibute to set and its value respectively in the attrName and attrValue parameters (in the form of variables, fields or literal values). You can pass as many attribute/value pairs as you want.

The attrValue parameter can be of the text type or another type (Boolean, integer, real, date or time). If you pass a value other than text, 4D handles its conversion to text, according to the following principles:

TypeExample of converted value
Boolean"true" or "false" (not translated)
Integer"123456"
Real"12.34" (the decimal separator is always ".")
Date"2006-12-04T00:00:00Z" (RFC 3339 standard)
Time"5233" (number of seconds)

Example

In the following XML source:

<Book>
   <Title>The Best Seller</Title>
</Book>

If the following code is executed:

   vAttrName:="Font"
   vAttrVal:="Verdana"
   DOM SET XML ATTRIBUTE(vElemRef;vAttrName;vAttrVal) 

We get:

<Book>
   <Title Font=Verdana>The Best Seller</Title>
</Book>

See Also

DOM GET XML ATTRIBUTE BY INDEX, DOM GET XML ATTRIBUTE BY NAME.

System Variables or Sets

If the command has been executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0 and an error is generated.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next