During an installation, I need to check for the existence of an XML file. If it isn't there I can copy across my own XML file, which is the easy part. However, if it exists I need to read through the nodes and either add a new node, or a adjust an existing node as necessary.
For example, lets assume this is the original XML file:
Now, the installer will always need to add the following XML for Entry3
<MyApp>
<UserStuff name="Entry1">
.
.
</UserStuff >
<UserStuff name="Entry2">
.
.
</UserStuff >
</MyApp>
If this node (Entry3) does NOT exist, then it will need to be added. However if the node already exists in the original XML file, the original node will need to be replaced with the new version.
<MyApp>
<UserStuff name="Entry3">
.
.
</UserStuff >
</MyApp>
I have looked over Wizou's nsisXML 1.4, and I can see that you can open a single XML file and select a node, but I will also need to open a second XML file, check to see if a node exists, then copy the saved node into the second file if it doesn't exist, or replace the node entirely.
I can't see a simple way to open multiple XML files and somehow copy nodes between them, or even to a temporary variable.
I hope this makes sense. If anyone has managed this I would for sure like to understand how it can be achieved.
From above, here is a summary of what I need to do:
1) If the Myapp.xml exists then Open it and check to see if the node "Entry3" exists
2) If the "Entry3" node doesn't exist, then copy the "Entry3" node from the second saved XML file to the Myapp.xml file
3) if "Entry3" node does exist, then modify/replace the node so that it is updated with the info in the saved XML (probably simpler to delete and re-add the node)