Set Attribute Value

This activity is used to set a value to any attribute in an XML file.

Technical Reference

 

 

INPUT

AttributeName: Specify the name of the attribute for which the details have to be set.

InputString: Specify the input values to be set for the attribute.

NodeName: Specify the node name in which the attribute value must be set.

 

 

 

 

 

MISC

DisplayName: Displays the name of the activity. You can also customize the activity name to help troubleshoot issues faster. This name will be used for logging purposes

SkipOnError: It specifies whether to continue executing the workflow even if it throws an error. This supports only Boolean value “True or False”. By default, it is set to “False.”

True: Continues the workflow to the next step

False: Stops the workflow and throws an error.

Version: It specifies the version of the XML automation feature in use

 

OUTPUT

Output: Declare a variable here to see the output of the updated file.

Result: Returns the success state of the activity.

*Mandatory fields to execute the workflow

Use Case

The following example illustrates how we can use this activity to set a value to an
attribute in a specific node. Here we are going to set the value “error” to the attribute
“sam” in the node “from”.

Steps to execute the bot

1.      Drag and drop a get XML object which is the scope for all other activities.

2.      Mention the xml path of the file and declare a variable in the output.

3.      Drag and drop the set attribute value activity within the scope.

4.      Specify the attribute name as “sam”.

5.      Specify the input string as “error” which is the value to be set for the attribute
“sam”.

6.      Specify the node name as “from” which has the attribute “sam” in it.

7.      Drag and drop the save XML activity to the workflow.

8.      Execute the workflow and open the XML file to see the newly set value of the
attribute.
 

The bot executes the activity and sets the value for the attribute “sam” as “error” in the
node “from”.