cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mercury
Level 3

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.
Labels (1)
0 Kudos
(1) Reply
Mercury
Level 3

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.
0 Kudos