This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
DOM SET XML ATTRIBUTE
|
DOM SET XML ATTRIBUTE ( elementRef ; attribName ; attrValue {; attribName2 ; attrValue2 ; ... ; attribNameN ; attrValueN} ) | ||||||||
Parameter | Type | Description | ||||||
elementRef | String |
![]() |
XML element reference | |||||
attribName | String |
![]() |
Attribute to set | |||||
attrValue | String, Boolean, Longint, Real, Time, Date |
![]() |
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:
Type | Example 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) |
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.
DOM GET XML ATTRIBUTE BY INDEX
DOM GET XML ATTRIBUTE BY NAME
DOM REMOVE XML ATTRIBUTE
XML SET OPTIONS
Product: 4D
Theme: XML DOM
Number:
866
Modified: 4D v11 SQL
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)