MSI Factory 2.3

XML.SetValue

XML.SetValue

This is the first topic This is the last topic  

XML.SetValue

This is the first topic This is the last topic  

OverviewExamples

XML.SetValue (

string XMLPath,

string Value,

boolean WriteCDATA = false )

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

 

-- Sets the first customer element's company name to "New Company Name".

XML.SetValue("database/customer/company", "New Company Name");

 

-- 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 first customer element's company name is set to "New Company Name" 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