activities
latest
false
- Vue d'ensemble (Overview)
- Cryptographie
- Base de donnés
- Java
- Python
- APIweb
Important :
Veuillez noter que ce contenu a été localisé en partie à l’aide de la traduction automatique.
La localisation du contenu nouvellement publié peut prendre 1 à 2 semaines avant d’être disponible.

Activités du développeur.
Dernière mise à jour 21 avr. 2026
Lire et désérialiser un fichier XML
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.
Remarque :
Download and extract the archive with the project in this example and copy the file daily_usd.xml to your project folder.
Voici comment le processus d'automatisation peut être créé :
- Ouvrez Studio et démarrez un nouveau Processus.
- Faites glisser un conteneur Séquence vers le concepteur de workflow.
-
Créez les variables suivantes :
Nom de variable Types de variables Valeur par défaut xmlChaîne de caractères (string) xmlDeserializedDocumentX xml_xpath_resultObjet xmlNodesIEnumerable xmlAttributesIEnumerable allExchRatesChaîne de caractères (string)
-
- 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.
- Ajoutez l’expression
"Exchange rates for " + xml_xpath_result.ToStringdans le champ Texte.
- Ajoutez l’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.
- Ajoutez l’expression
xmlAttributes(0).Name.Tostring + ": " + xmlAttributes(0).Value.Tostringdans le champ Texte.
- Ajoutez l’expression
- Add an Assign activity after the Message Box activity.
- Ajoutez la variable
allExchRatesdans le champ À. - Ajoutez l’expression
"Exhange Rates" + System.Environment.NewLinedans le champ Valeur.
- Ajoutez la 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.
- Ajoutez la variable
allExchRatesdans le champ À. - 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`.
- Ajoutez la variable
- Add a Message Box activity after the For Each activity.
-
Ajoutez la variable
allExchRatesdans le champ Texte.
-
- Exécutez le processus. Le fichier XML est lu, désérialisé et accessible. Quelques boîtes de message s'affichent avec des informations extraites du fichier.
Ici, vous pouvez télécharger un exemple.