Field-Map Scripting

4.1.11.3.2 GetElement

GetElement function


Prototype:

function GetElement(index: integer): TScriptXMLElement;

Description:

The GetElement function returns an XML element from the list of XML elements. The result is an instance of the TScriptXMLElement class

Syntax:

variable := TScriptXMLElementList.GetElement(Index);


Part

Description


variable

A variable declared as an instance of the TScriptXMLElement class


TScriptXMLElementList

A variable declared as an instance of the TScriptXMLElementList class


Index

Index identification of the desired Element from the XMLElementList

Return value:

An XML element as an instance of the TScriptXMLElement class


Note: This function is available since version X7.


Example:


var

  ElementList: TScriptXMLElementList;

  Element: TScriptXMLElement;

  i: integer;

  AttributeName, LayerName: string;


begin

// open XML document and assign Element


  ElementList := Element.GetChildElements('');


for i := 0 to ElementList.GetCount - 1 do

begin

with ElementList.GetElement(i) do

begin

       if HasAttribute('LAYER') then

        LayerName := GetStringAttributeAsString('LAYER');

       if HasAttribute('ATTRIBUTE') then

        AttributeName := GetStringAttributeAsString('ATTRIBUTE');

end;

end;

end.



See also:

GetCount; GetElement; FreeXMLElementList


Example