XML read

HI, how can I get data form XML. I want to read data Amt and Cst from all Ntry’s.

Hi @tomaz

Initially Need to install the UiPath.WEBAPI.Activities. Package.
The Read Text File activity will read the XML file and store the contents as a string.
The Deserialize XML activity will then deserialize the string into an object.
The For Each activity will loop through the Ntry elements in the object and get the values for each element.

Hope it helps!!

Hi,

Your xml seems wrong format because there is no end tag for Sct ( no start tag for Cst).

image
If it’s Cst, the following sample will help you.

Sample20230715-1aL.zip (2.9 KB)

Regards,

What do I need to put in For each activity?
For now I have this, but it’s showing me only first result
DeserialisedXML.Element(“Document”).Element(“BkToCstmrStmt”).Elements(“Ntry”)

@tomaz

Hi,

Drag “Read Text File" activity into the designer panel, pass the .XML file’s path to it and save the output to a string variable.

Drag “Deserialize XML” activity into the designer panel to deserialize XML string. Supply the variable “xml_Data” to it as input and create a variable called “out_XML” of XDocument type.

This will help you extract your data.

Thanks

@tomaz
As it is collection datatype need to use for each to access the elements.

Hope it helps!!

Sorry they should be the sama. I was changing it for security and mistype

Hi,

All right. The above sample will work if there is no specific namespace definition in your original xml. Can you try it?

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.