XML Assistance

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:

  1. Retrieve XML String
  2. Utilize Deserialize XML and convert into an XDocument type of variable.
  3. Utilize For Each activity and change the TypeArgument in the For Each loop to System.Xml.Linq.XElement
  4. 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!

you need to handle XML namespaces as described here:

1 Like

Great! Thank you
I’ll give it a read!

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