4D v14.3

DOM SET XML ATTRIBUTE

Home

 
4D v14.3
DOM SET XML ATTRIBUTE

DOM SET XML ATTRIBUTE 


 

DOM SET XML ATTRIBUTE ( elementRef ; attribName ; attrValue {; attribName2 ; attrValue2 ; ... ; attribNameN ; attrValueN} ) 
Parameter Type   Description
elementRef  String in XML element reference
attribName  String in Attribute to set
attrValue  String, Boolean, Longint, Real, Time, Date in New attribute value

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

Pass the attribute you want 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"
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>

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.

 
PROPERTIES 

Product: 4D
Theme: XML DOM
Number: 866

The OK variable is changed by the command

 
HISTORY 

Modified: 4D v11 SQL

 
SEE ALSO 

DOM GET XML ATTRIBUTE BY INDEX
DOM GET XML ATTRIBUTE BY NAME
DOM REMOVE XML ATTRIBUTE
XML SET OPTIONS

 
ARTICLE USAGE

4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)