4D v14.3

DOM GET XML ATTRIBUTE BY NAME

Home

 
4D v14.3
DOM GET XML ATTRIBUTE BY NAME

DOM GET XML ATTRIBUTE BY NAME 


 

DOM GET XML ATTRIBUTE BY NAME ( elementRef ; attribName ; attribValue ) 
Parameter Type   Description
elementRef  String in XML element reference
attribName  String in Attribute name
attribValue  Variable in 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 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.

Example  

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.

 
PROPERTIES 

Product: 4D
Theme: XML DOM
Number: 728

The OK variable is changed by the commandThis command modifies the Error system variable

 
HISTORY 

Modified: 4D 2004

 
SEE ALSO 

DOM GET XML ATTRIBUTE BY INDEX
DOM REMOVE XML ATTRIBUTE

 
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)