You are here: Function Reference > Alphabetical Listing > X > XMLFirstAttrib

XMLFirstAttrib

Use this function to set the current pointer to the first element in the list you specify.

Syntax

XMLFirstAttrib (%XMLTree)

Parameter

Description

%XMLTree

Enter a list type DAL variable. You can enter either an XML tree or a list of extracted elements.

This function sets the attribute pointer to the first attribute for the current element in the element list or to the first attribute element in the attribute list.

If you input an element list, use these functions to retrieve the attribute name and value:

If you input an attribute list, use these functions to retrieve attribute name and value:

The system returns one (1) for success or zero (0) for failure.

Example

This example returns text from the last element in the list.

aStr="Text not found!";
%xXMLTree=LoadXMLList("test.xml");
%XMLTree=XMLFind(%xXMLTree,"Forms","Form[text()]");
#rc=XMLFirst(%XMLTree);
loop:
if #rc=0
goto endloop:
end
aStr=XMLGetCurName(%XMLTree);
#rc=XMLNext(%XMLTree);
goto loop:
endloop:
#rc=DestroyList(%xXMLTree);
return(aStr);

See also