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
- :
- Re: Help please... XML load error :(
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Oct 13, 2009
05:40 AM
Help please... XML load error :(
I'm trying to update an xml file this code works except for the xml file location. I want to update the xml file after it has been installed to the [INSTALLDIR]:
strFileName = INSTALLDIR ^ "\\mobile.xml\\";
I got an error after the loading of the xml... what code should I use to find the location of the not yet installed xml file in that [INSTALLDIR] because the installer has not yet finished installing it?
And If I would place this in the custom action, where should i put this?
thank you very much!
------
function ModifyWebConfig(hMSI)
OBJECT oDoc, oNode, oNodeList;
NUMBER i,nSize,nResult, nTemp ;
STRING strNamedItem;
STRING strFileName ;
STRING svFileURLName ;
BOOL bTryAgain;
begin
bTryAgain =FALSE;
strFileName = INSTALLDIR ^ "\\mobile.xml\\";
// Get the path of the license directory path name.
AskText (MSG_TEXT, DEFAULT_PATH, svFileURLName );
//====================================================
///////////////////////////////////////////////////////////////////////////
// get values from public properties
///////////////////////////////////////////////////////////////////////////
set oDoc = CreateObject("Msxml2.DOMDocument.3.0");
if (IsObject(oDoc) = FALSE) then
MessageBox(ERROR_XML_FILE_CREATION, 0);
return -1;
endif;
oDoc.async = FALSE;
oDoc.setProperty("SelectionLanguage", "XPath");
///////////////////////////////////////////////////////////////////////////
// if success, traverse file and substitute value //
///////////////////////////////////////////////////////////////////////////
if oDoc.load(strFileName) then
///////////////////////////////////////////////////////////////////////
// get list of matching nodes //
///////////////////////////////////////////////////////////////////////
set oNodeList = oDoc.getElementsByTagName("*");
if (oNodeList.length > 0) then
for i = 0 to (oNodeList.length - 1);
set oNode = oNodeList.nextNode;
try
strNamedItem = oNode.attributes.getNamedItem("key").value;
catch
strNamedItem = "";
endcatch;
try
if strNamedItem = "serviceUrl" then
oNode.attributes.getNamedItem("value").value = svFileURLName ;
endif;
catch
endcatch;
endfor;
else
MessageBox(ERROR_XML_FILE_STRUCTURE,SEVERE);
return -1;
endif;
else
MessageBox(ERROR_XML_FILE_LOAD,SEVERE);
return -1;
endif;
oDoc.save(strFileName);
set oDoc = NOTHING;
end;
strFileName = INSTALLDIR ^ "\\mobile.xml\\";
I got an error after the loading of the xml... what code should I use to find the location of the not yet installed xml file in that [INSTALLDIR] because the installer has not yet finished installing it?
And If I would place this in the custom action, where should i put this?
thank you very much!
------
function ModifyWebConfig(hMSI)
OBJECT oDoc, oNode, oNodeList;
NUMBER i,nSize,nResult, nTemp ;
STRING strNamedItem;
STRING strFileName ;
STRING svFileURLName ;
BOOL bTryAgain;
begin
bTryAgain =FALSE;
strFileName = INSTALLDIR ^ "\\mobile.xml\\";
// Get the path of the license directory path name.
AskText (MSG_TEXT, DEFAULT_PATH, svFileURLName );
//====================================================
///////////////////////////////////////////////////////////////////////////
// get values from public properties
///////////////////////////////////////////////////////////////////////////
set oDoc = CreateObject("Msxml2.DOMDocument.3.0");
if (IsObject(oDoc) = FALSE) then
MessageBox(ERROR_XML_FILE_CREATION, 0);
return -1;
endif;
oDoc.async = FALSE;
oDoc.setProperty("SelectionLanguage", "XPath");
///////////////////////////////////////////////////////////////////////////
// if success, traverse file and substitute value //
///////////////////////////////////////////////////////////////////////////
if oDoc.load(strFileName) then
///////////////////////////////////////////////////////////////////////
// get list of matching nodes //
///////////////////////////////////////////////////////////////////////
set oNodeList = oDoc.getElementsByTagName("*");
if (oNodeList.length > 0) then
for i = 0 to (oNodeList.length - 1);
set oNode = oNodeList.nextNode;
try
strNamedItem = oNode.attributes.getNamedItem("key").value;
catch
strNamedItem = "";
endcatch;
try
if strNamedItem = "serviceUrl" then
oNode.attributes.getNamedItem("value").value = svFileURLName ;
endif;
catch
endcatch;
endfor;
else
MessageBox(ERROR_XML_FILE_STRUCTURE,SEVERE);
return -1;
endif;
else
MessageBox(ERROR_XML_FILE_LOAD,SEVERE);
return -1;
endif;
oDoc.save(strFileName);
set oDoc = NOTHING;
end;
(4) Replies
‎Oct 13, 2009
06:54 AM
Call the function ModifyWebConfig() just before the appearance of finish dialog SdFinishEx. It wont give the error.
and also provide the file path as follows :
strFileName = INSTALLDIR ^ "mobile.xml";
and also provide the file path as follows :
strFileName = INSTALLDIR ^ "mobile.xml";
‎Oct 13, 2009
11:01 PM
ChandanOmkar:
thank you for giving me an idea about this but unfortunately I am doing this in Basic MSI Installer I could not find the SdFinishEx or even SdFinish here.
Where can I place this in the custom action and sequence tab?
thank you for giving me an idea about this but unfortunately I am doing this in Basic MSI Installer I could not find the SdFinishEx or even SdFinish here.
Where can I place this in the custom action and sequence tab?
‎Oct 14, 2009
09:11 PM
Lurean:
thank you for your reply. I have tried this one but for now i was not able to put this in practice: I would like to ask the user to update the url in the xml, this then, i will be placing a string variable perhaps and set its property
(msisetproperty) but it does not get updated in the attribute section. i may be missing something that is why i just used the code instead.
I have made this possible in the installscript code.. but what i wanted to do was just to find the location where i would place this the installer before the setupcompleteprocess is called.
thank you for your reply. I have tried this one but for now i was not able to put this in practice: I would like to ask the user to update the url in the xml, this then, i will be placing a string variable perhaps and set its property
(msisetproperty) but it does not get updated in the attribute section. i may be missing something that is why i just used the code instead.
I have made this possible in the installscript code.. but what i wanted to do was just to find the location where i would place this the installer before the setupcompleteprocess is called.