Elist
Elist

Reputation: 5533

WiX - add XML element after a specific element

I need to modify an existing XML file, during installation, so that a new element will be added to the root, but in a specific location (the XML file is order-sensitive).

<RootNode>
    <Child1/>
    <Child3/>
</RootNode>

should become:

<RootNode>
    <Child1/>
    <Child2/>
    <Child3/>
</RootNode>

This WiX Component:

<Component Id="AddMenuItems" Guid="MyGUID">
    <util:XmlFile Id='XmlAdd' File='[SOMEEXISTINGDIRECTORY]XmlFile.xml' Action='createElement' Name='Child2' ElementPath='//RootNode' Sequence='1'/>
</Component>

Generates the following:

<RootNode>
    <Child1/>
    <Child3/>
    <Child2/>
</RootNode>

Upvotes: 0

Views: 149

Answers (1)

Sanketh P B
Sanketh P B

Reputation: 404

if order of child elements is required, then create all the child elements during installation in the required order (add correct sequence) or you have to use custom action dlls to add it at particular order.

Upvotes: 1

Related Questions