Task XML - Edit Node
The Edit Node Task changes the value of a node, or of one of its attributes, in an XML file.

The Main settings, Flow, On error, Conditions and TimeOut tabs are the same for every Task; see Job - Tasks.
The Task saves its changes to the XML file itself and keeps no copy of the original file.
Without an attribute, the new value replaces the whole content of the node. If the node has child nodes, they are removed.
When Attribute (optional) is set and a selected node does not have that attribute, nothing is changed in that node, no error is raised, and the Task reports success.
Edit Node tab
- Credentials: The Credential the Task uses to read and save the file. Select a Credential in the list, or click the icon next to it to open Manage credentials. With no Credential, the file is accessed under the account of the VisualCron Server
- File name: The full path of the XML file
- XPath expression: The XPath expression that selects the node to edit. To build the expression, click the button next to the field and select a node in the XML Browser; the button is available when File name is set
- Attribute (optional): The name of an attribute. When set, the new value is written to this attribute instead of to the node
- Value: The new value. The field must not be empty
- Edit node: Which of the selected nodes are changed. The default is "First"
- "First": Only the first node that the XPath expression selects
- "All": Every node that the XPath expression selects
- Namespaces: The namespace prefixes and URIs that the XPath expression can use. When the list is empty, the Client fills it with the namespaces declared in the file, with the prefix "x" for a default namespace. Use Add, Edit and Remove to change the list, and Reload to read the namespaces from the file again
At run time, the Task also adds the namespaces declared in the file, with the prefix "x" for a default namespace ("xx" if "x" is already in use). With "First", when the XPath expression selects nothing, the Task tries it again with a namespace prefix added to each step of the path that has none.
Variables can be used in File name, XPath expression, Attribute (optional), Value and the namespace prefixes and URIs.
Output and errors
- The output of the Task is the inner XML of the edited node. With "All", it is the inner XML of the last edited node
- When the XPath expression selects no node, the Task fails, and the file is not changed. With "First", the error is "Node does not exist."