XML - Write Node
This custom action lets you set the text content of an existing XML node, or create a new node.
This custom action has two different behaviors, depending on whether Name is set or not.
-
If you leave Name blank, the node whose XPath is defined by PathToNode will have its text set to the contents specified with “Value”. The node must exist.
-
If you set Name, a new node with this name is created. The node parent is defined by PathToNode. The node text is also set to the contents specified with “Value”.
| Property Name | Data Type | Description |
|---|---|---|
| IDXML | TXMLID | A unique string identifier associated to the opened XML resource you want to write data to. |
| Name | String | Name of the node. Optional: see above |
| PathToNode | XPath | XPath expression to the parent node (if you create a new XML node) or to the existing node (if you want to change its text content). |
| Value | String | This is the text you want to assign to the node. You can use variables such as %DESTPATH%. |
Behavior when the node does not exist
Section titled “Behavior when the node does not exist”-
Update mode (Name is blank): If the XPath expression does not match any existing node (for example, if the parent element is self-closing like
<System />instead of<System><Backuppath>value</Backuppath></System>), the write operation is silently skipped — no error occurs and no node is created. -
Create mode (Name is set): If the parent node specified by PathToNode does not exist, the new child node is not created.
PathToNode explanation
Section titled “PathToNode explanation”Use of XPath is explained at http://msdn.microsoft.com/en-us/library/ms256086.aspx