This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Need to pass values from XML file to msi at run time
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Dec 05, 2018
07:17 AM
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?
- Tags:
- xml with msi
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Dec 06, 2018
11:01 AM
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.
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;