MSI Factory 2.3

XML.InsertXML

XML.InsertXML

This is the first topic This is the last topic  

XML.InsertXML

This is the first topic This is the last topic  

OverviewExamples

XML.InsertXML (

string XMLPath,

string Text,

number InsertionMode )

Example 1

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

 

-- we'll use the debug window to show what's happening

Debug.ShowWindow(true);

 

-- get the raw XML for the first customer's address_info and display it in the debug window

strAddress = XML.GetElementXML("database/customer/address_info");

 

Debug.Print(strAddress.."\r\n\r\n");

-- insert a planet element right after the country element

Debug.Print("Inserting planet...\r\n");

 

XML.InsertXML("database/customer/address_info/country", "<planet>Earth</planet>", XML.INSERT_AFTER);

 

-- check for errors

error = Application.GetLastError();

-- If an error occurred, display the error message.

if (error == 0) then

   Debug.Print("Planet inserted.\r\n\r\n");

else

   Debug.Print("Error: ".. _tblErrorMessages[error] .. "\r\n");

end

 

-- get the raw XML again and display it in the debug window to show what has changed

strAddress = XML.GetElementXML("database/customer/address_info");

Debug.Print(strAddress.."\r\n\r\n");

Gets the raw XML for the first customer's address_info, inserts some new information in it and then gets the raw XML again to show the changes. All output is shown in the debug window.

See also: Related Actions


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