Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3421004
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:03:57+00:00 2026-05-18T06:03:57+00:00

Question: I am struggling trying to figure out how to update some attributes in

  • 0

Question:

I am struggling trying to figure out how to update some attributes in an XML file using InstallScript. I would like to use proper XML parsing functions, but I can’t find anything that suggests this version of InstallScript is capable of it. How can I do this? Should I just attempt falling back on a combination of FileInsertLine and FileGrep? Is there a library I’m missing?

Background:

What software versions?
I am using InstallShield 11 on Windows Server 2003 R2.

Why am I not just using the existing ‘XML File Changes’ feature?
Because I am doing an upgrade and running into this bug. It affects the XML File Change feature because it is tied to a Component (well, that’s my guess). I spent too long trying the official workaround, but couldn’t coax it to work. I eventually found out it was much easier and more reliable to copy the files over using InstallScript + a single line batch file. It feels a bit hacky, but it is something that actually works.

Now I am trying to figure out the easiest and simplest-to-figure-out-years-later way to replicate the effects of the ‘XML File Changes’ feature in InstallScript.

Please let me know if you need any more information, I will be glad to provide it.

EDIT:

I ended up going with the InstallScript way to do it after all – it has tended to be the way that everything else in this installer project was implemented, and it looked (and turned out to be) pretty quick to do. I started out with the code shown by TheTraveler in that thread and modified it to suit my needs.

Here is the code:

prototype UpdateWebConfigAttributes();  
prototype ReplaceValueOf(OBJECT, STRING, STRING);   

function UpdateWebConfigAttributes()
    OBJECT oDoc, oNode;
    NUMBER i;                  
    STRING sWebConfigFilePath;   
    BOOL successfulLoad;
begin   

    sWebConfigFilePath = "Path\\To\\Web.config";  

    if Is(FILE_EXISTS, sWebConfigFilePath) = FALSE then
        MessageBox("Could not find Web.config file.", 0);
    endif;

    // get values from public properties
    set oDoc = CreateObject("Msxml2.DOMDocument.4.0");  
    if !IsObject(oDoc) then
        MessageBox("Could not create XML Document", 0);
        return -1;     
    endif;     

    oDoc.async = FALSE;  
    oDoc.setProperty("SelectionLanguage", "XPath");

    successfulLoad = oDoc.load(sWebConfigFilePath);
    if !successfulLoad then
        MessageBox("Could not load Web.config as an xml file", SEVERE);                         
        return -1;
    endif;

    ReplaceValueOf(oDoc, "//add[@key=\"ConnectionDriver\"]", CONNECT_DRIVER);
    ReplaceValueOf(oDoc, "//add[@key=\"ConnectionType\"]", CONNECT_TYPE);
    ReplaceValueOf(oDoc, "//add[@key=\"ConnectionString\"]", CONNECT_STRING_WEBCONFIG);
    ReplaceValueOf(oDoc, "//add[@key=\"ShowConnection\"]", "False");

    oDoc.save(sWebConfigFilePath);
    set oDoc = NOTHING;
end;   


function ReplaceValueOf(oDoc, xPath, valueToPutIn)
    OBJECT oNode;
begin
    set oNode = oDoc.selectNodes(xPath)(0);
    try
        oNode.attributes.getNamedItem("value").value = valueToPutIn;
    catch 
        MessageBox("Could not set '" + xPath + "' with '" + valueToPutIn + "'", SEVERE);
    endcatch;  
end;    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:03:58+00:00Added an answer on May 18, 2026 at 6:03 am

    I recall the XML Changes being pretty buggy back in those days. What project type are you using? If it’s an MSI type then I would create a merge module in WiX and use it’s XML changes pattern. You can then add that merge module to your InstallShield project.

    If you really do want to do it in InstallScript then you are going to have to use CoCreateObject() to call into an XML DOM.

    There is a discussino and example over at XML Installscript

    But again, I wouldn’t do it this way. I’d either upgrade to a newer version of InstallShield or I’d leverage the Util extension in WiX to keep it declarative. I don’t like writing these types of custom actions as it usually doesn’t end well.

    Util Schema

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a question Im trying to figure out for a job pre-interview questioniar.
I'm trying to figure out how to properly use the OpenSSL.Session API in a
I'm struggling trying to figure out if I should go native or if I
This might seem an easy question for some, but I am struggling with it.
I know this is a very beginner question, but I've been struggling to figure
I'm struggling with this for some hours now. I'm trying to get some swt
Struggling to figure out how to Over-Ride the __init__() method in my Django Form
Using this question and answer ( Use both Account and User tables with Devise
We are trying to figure out whether it makes sense to move to git
Like others before me I'm struggling with scope in Javascript. (That and trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.