Hey there!
I’m working with the UiPath Workday Activities and I’m retrieving the output results of a report and they’re being shown as an XML file, said XML file has the following format:
<wd:Report_Data xmlns:wd="Workday Namspace">
<wd:Report_Entry>
<wd:First_Name>John</wd:First_Name>
<wd:Last_Name>Doe</wd:Last_Name>
<wd:Employee_ID>000000</wd:Employee_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<<wd:First_Name>Jane</wd:First_Name>
<wd:Last_Name>Doe</wd:Last_Name>
<wd:Employee_ID>111111</wd:Employee_ID>
</wd:Report_Entry>
</wd:Report_Data>
I want to retrieve the First_Name out of the existing nodes. For that I’m performing the following steps:
- Retrieve XML String
- Utilize Deserialize XML and convert into an XDocument type of variable.
- Utilize For Each activity and change the TypeArgument in the For Each loop to System.Xml.Linq.XElement
- Add into the In box the following statement: XMLDocument.Element(“Report_Data”).Elements(“Report_Entry”).Descendants(“First_Name”) But I’m getting the following error: For Each: Object reference not set to an instance of an object.
Please assist me to retrieve the First Name out of the existing elements in the XML file.
Thanks!