MSI Factory 2.3

XML.RemoveElement

XML.RemoveElement

This is the first topic This is the last topic  

XML.RemoveElement

This is the first topic This is the last topic  

OverviewExamples

XML.RemoveElement (

string XMLPath )

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

 

-- Removes the address info element from the first customer entry.

XML.RemoveElement("database/customer/address_info");

 

-- 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 first shows it in a dialog message. Next, the address info element is removed from the first customer entry and the XML is reloaded as a string. The final XML is then shown in a dialog message.

See also: Related Actions


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