DOM GET XML ATTRIBUTE BY NAME

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 2004 (Modified)


DOM GET XML ATTRIBUTE BY NAME (elementRef; attribName; attribValue)

ParameterTypeDescription
elementRefStringXML element reference
attribNameStringAttribute name
attribValueVariableAttribute value

Description

The DOM GET XML ATTRIBUTE BY NAME command is used to get 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. 4th Dimension will attempt 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_STRING(16;$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:

See Also

DOM GET XML ATTRIBUTE BY INDEX.

System Variables or Sets

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


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next