- Overview
- Cryptography
- Database
- Java
- Python
- WebAPI

Developer Activities
The following example explains how to use activities such as Deserialize XML, Execute XPath, Get XML Nodes, or Get XML Node Attributes for reading, deserializing, accessing, and displaying various information about an XML file. You can find these activities in the UiPath.WebAPI.Activities package.
This is how the automation process can be built:
- Open Studio and create a new Process.
-
Drag a Sequence container in the Workflow Designer.
-
Create the following variables:
Variable Name
Variable Type
Default Value
xmlString
xmlDeserializedXDocument
xml_xpath_resultObject
xmlNodesIEnumerable<XNode>
xmlAttributesIEnumerable<XAttribute>
allExchRatesString
-
-
Add a Read Text File activity inside the Sequence.
- Add the expression
"daily_usd.xml"in the File Name field. - In the Properties panel, add the variable
xmlin the Content field.
- Add the expression
-
Add a Deserialize XML activity after the Read Text File activity.
- Add the variable
xmlin the XML String field. - In the Properties panel, add the variable
xmlDeserializedin the XMLDocument.
- Add the variable
-
Add an Execute XPath activity after the Deserialize XML activity.
- Add the variable
xmlDeserializedin the Existing XML field. - Add the expression
"string(/channel/lastBuildDate)"in the XPath Expression field. - In the Properties panel, add the variable
xml_xpath_resultin the Result field.
- Add the variable
-
Add a Message Box activity after the Execute XPath activity.
- Add the expression
"Exchange rates for " + xml_xpath_result.ToStringin the Text field.
- Add the expression
-
Add a Get XML Nodes activity after the Message Box activity.
- Add the variable
xmlDeserializedin the ExistingXML field. - In the Properties panel, add the variable
xmlNodesin the XMLNodes field.
- Add the variable
-
Add a Get XML Node Attributes activity after the Get XML Nodes activity.
- Add the expression
xmlNodes(0)in the Existing XML Node field. - In the Properties panel, add the variable
xmlAttributesin the Attributes field.
- Add the expression
-
Add a Message Box activity after the Get XML Node Attributes activity.
- Add the expression
xmlAttributes(0).Name.Tostring + ": " + xmlAttributes(0).Value.Tostringin the Text field.
- Add the expression
-
Add an Assign activity after the Message Box activity.
- Add the variable
allExchRatesin the To field. - Add the expression
"Exhange Rates" + System.Environment.NewLinein the Value field.
- Add the variable
-
Add a For Each activity after the Assign activity.
- Add the expression
xmlDeserialized.Element("channel").Elements("item")in the Values field. - In the Properties panel, select the System.Xml.Linq.XElement option from the TypeArgument drop-down list.
- Add the expression
-
Add an Assign activity inside the Sequence container of the For Each activity.
- Add the variable
allExchRatesin the To field. - Add the following expression in the Value field:
allExchRates + System.Environment.NewLine + "1 " + item.Element("baseName").Value.ToString + " = " + item.Element("exchangeRate").Value.ToString + " " + item.Element("targetName").Value.ToString.
- Add the variable
-
Add a Message Box activity after the For Each activity.
-
Add the variable
allExchRatesin the Text field.
-
- Run the process. The XML file is read, deserialized, and accessed. A few message boxes are displayed with information extracted from the file.
Here you can download an example.