Array of XML files

I’m trying to read all xml files from my documents folder. I’ve tried to create an array of Objects (Xdocuments and XObjects too) and then read one by one using for each loop. This is not working, when I execute the robot it says “For Each: Unable to convert an object of type ‘System.String’ to type ‘System.Xml.Linq.XDocument’.”

for each’s type of argument is xdocument

Is there any other way to do this?

in case of you want to process all XML files within a for each then do following:

For each activity: item in Directory.GetFiles(“Path”, *.xml) | TypeArgument is string

  • Deserialize XML Activity | item | output: myXDoc - Datatype: XDocument
  • Do your processing with the myXDoc

It shows the message "
Deserialize XML: Invalid root-level data. Line 1, position 1."

(The output in Deserialize XML is xDoc)

looks like invalid XML and is independed from the suggestion / approach.

You can do following:

  • share this sample XML with us
  • validate the XML e.g. with the help of an online xml validator

it was working with your sample:
grafik

can you crosscheck your Implementation on the read text file part?

After add Read text file activity it worked!

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