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: IS 2009 Basic MSI: using Installscript to update XML nodes.
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
Aug 24, 2010
05:12 PM
IS 2009 Basic MSI: using Installscript to update XML nodes.
Hi,
Using Installscript in a Basic MSI project, I am trying to add elements to an XML node. I am using XPath expressions in a function to successfully change existing elements, but, using the same Installscript file, how do I add an XML element within the same function? The element I'd like to add would be something like "domainName="companyname"" and would be added somewhere between the node opening "<" and closing tag /">"
Because the Installscript function is called from a deferred execution custom action, I don't think I can use "XML File Changes", which has a default Execution mode.
Would anyone have a sample of Installscript code which adds a new element to an xml node? And is it likely I'll have to create a new function to "add" elements?
Thanks.
Using Installscript in a Basic MSI project, I am trying to add elements to an XML node. I am using XPath expressions in a function to successfully change existing elements, but, using the same Installscript file, how do I add an XML element within the same function? The element I'd like to add would be something like "domainName="companyname"" and would be added somewhere between the node opening "<" and closing tag /">"
Because the Installscript function is called from a deferred execution custom action, I don't think I can use "XML File Changes", which has a default Execution mode.
Would anyone have a sample of Installscript code which adds a new element to an xml node? And is it likely I'll have to create a new function to "add" elements?
Thanks.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 07, 2010
02:21 PM
I solved this issue by using the "XML File Changes" view and importing the xml file, then locating first the root node and then the sub node in which I needed to add elements, and then adding the two new attibutes(elements) and their values to this sub node. In the Attributes field I left only the new entries. I deleted all the other old attributes (which don't need to be altered).
Next in the Custom Actions view, I changed the Install Exec Sequence of the "ISXmlInstall" Custom Action from "After InstallFiles" to "After UpdateMyXMLFile". During the installation, this added the two new elements to their sub node.
Next in the Custom Actions view, I changed the Install Exec Sequence of the "ISXmlInstall" Custom Action from "After InstallFiles" to "After UpdateMyXMLFile". During the installation, this added the two new elements to their sub node.
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)