XML.GetAttribute

string XML.GetAttribute ( 

string XMLPath,

string AttributeName )

Example 1

-- This example assumes the sample XML is already loaded into memory.

-- Get the value of the first customer id attribute.
attribute_result = XML.GetAttribute("database/customer", "id");

-- Perform some error checking.
error = Application.GetLastError();
if (error == 0) then
     Dialog.Message("Attribute Value", "The first customer id is: "..attribute_result);
else
     Dialog.Message("Error", _tblErrorMessages[error]);
end

Gets the value of the first customer id attribute and displays it in a dialog message.

Example 2

-- This example assumes the sample XML is already loaded into memory.

-- Get the value of the second customer product attribute.
attribute_result = XML.GetAttribute("database/customer:2", "product");

-- Perform some error checking.
error = Application.GetLastError();
if (error == 0) then
     Dialog.Message("Attribute Value", "The second customer's product is: "..attribute_result);
else
    Dialog.Message("Error", _tblErrorMessages[error]);
end

Gets the value of the second customer product attribute and displays it in a dialog message.

See also:  Related Actions