This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
DOM GET XML ATTRIBUTE BY NAME
|
DOM GET XML ATTRIBUTE BY NAME ( elementRef ; attribName ; attribValue ) | ||||||||
Parameter | Type | Description | ||||||
elementRef | String |
![]() |
XML element reference | |||||
attribName | String |
![]() |
Attribute name | |||||
attribValue | Variable |
![]() |
Attribute value | |||||
The DOM GET XML ATTRIBUTE BY NAME command gets the value of an attribute specified by name.
Pass the reference of an XML element in elementRef and the name of the attribute that you want to know the value of in attribName. The value is returned in the attribValue parameter. 4D attempts to convert the value obtained into the same type as that of the variable passed as parameter. If the variable type is not defined, the value is returned in text type by default.
If no attribName attribute exists in the XML element, an error is returned. If several attributes of the XML element have the same name as that specified, only the value of the first attribute is returned.
This method is used to retrieve the value of an XML attribute using its name:
C_BLOB(myBlobVar)
C_TEXT($xml_Parent_Ref;$xml_Child_Ref)
C_LONGINT($LineNum)
$xml_Parent_Ref:=DOM Parse XML variable(myBlobVar)
$xml_Child_Ref:=DOM Get first child XML element($xml_Parent_Ref)
DOM GET XML ATTRIBUTE BY NAME($xml_Child_Ref;"N";$LineNum)
If this method is applied to the example below, $LineNum contains the value 1:
If the command has been correctly executed, the system variable OK is set to 1. If an error occurs, it is set to 0.
Product: 4D
Theme: XML DOM
Number:
728
Modified: 4D 2004
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)