cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tedcbe
Level 2

Need to pass values from XML file to msi at run time

I have been given an xml file and the values from this file needs to be passed to an msi on run time. Can someone help me with this?
Labels (1)
0 Kudos
(1) Reply
DLee65
Level 13

I have done this in my Suite package using InstallScript. The code below can be modified to work with MSI. In this code I implement a generalized logging method that simply calls SuiteLogInfo, but you can call SprintfMsiLog instead.
This code snippet is part of a method where I pass in the element name and get its value. I do not have code to get XML attributes.

	szFile = szSourceFilePath ^ "mysourceFile.xml";
SuiteLogInfo("Searching for xml value in %s", szFile);
if (Is(FILE_EXISTS, szFile)) then
//Open file for read permission
try
OpenFileMode(FILE_MODE_NORMAL);
if (OpenFile(nvFileHandle, szInstallPath, "systemsettings.xml") < 0) then
Err.Raise(ERROR_OPEN_FAILED);
endif;

while (GetLine(nvFileHandle, svLine) == 0)
//GetValueIfFound
SuiteLogInfo("Searching for %s in line: %s", p_szName, svLine);
if (StrFindEx(svLine, p_szName, 0) >= 0) then
//Trim leading spaces
StrTrim(svLine);
SuiteLogInfo("INFORMATION: Found value for %s in systemsettings.xml", p_szName);
posStart = StrFindEx(svLine,">",0) + 1;
posEnd = StrFindEx(svLine, " SuiteLogInfo("INFORMATION: grabbing value between position %d and %d",posStart, posEnd);
StrSub(svValue, svLine, posStart, posEnd-posStart);
return svValue;
endif;
endwhile;
catch
/* Exception handler */
SuiteLogInfo("WARNING: Unable to obtain information for %s from systemsettings.xml", p_szName);
endcatch;
0 Kudos