MSI Factory 2.3

XML.SetAttribute

XML.SetAttribute

This is the first topic This is the last topic  

XML.SetAttribute

This is the first topic This is the last topic  

OverviewExamples

XML.SetAttribute (

string XMLPath,

string AttributeName,

string AttributeValue )

Example 1

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

 

-- Return the currently loaded XML in a string.

strXML = XML.GetXML();

 

if (strXML ~= "") then

   Dialog.Message("Original XML contents",strXML);

end

 

-- Changes the second customer element's attribute id to "9999".

XML.SetAttribute("database/customer:2", "id", "new id");

 

-- See if any errors occurred. If no errors occurred, display the string.

error = Application.GetLastError();

if (error == 0) then

   -- Return the currently loaded (modified) XML in a string.

   strXML = XML.GetXML();

   if (strXML ~= "") then

       Dialog.Message("Modified XML contents",strXML);

   end

else

   Dialog.Message("Error", _tblErrorMessages[error]);

end

Gets the currently loaded XML as a string and shows it in a dialog message. Next, the second customer element's attribute id is changed to "9999" and the new XML is shown in a dialog message.

See also: Related Actions


Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us