I have the below XML file and im trying to extract into a datatable
ApplicationCorrespondance - surrounds the entire file
Each Section is
I need to extract everything in the picture
I have For Each loop set to XML.LINQ.XELEMENT
but now I am stuck
Welcome to the forum
Deserialize the XML with the deserialze XML acttivity - xDoc as output Variabtt
For each Activity: item in cDoc.Root.Descendants(“DocumentData”)
- (Again A nested loop):
- For Each xe in item.Elements()
- Log Message: xe.Name & " - " & item.Value
Welcome to UiPath community
Have a look on the docs
Hope it will help
Thankyou both for your replies, I have now managed to extract the data but now have another issue.
Im writing the data to a datatable, putting all of the items as an array. The only issue I have is if one of the items is not in the DocumentData it throughs an error.
So say some of the DocmuentData’s may or may not Contain thus thrwoing the error. I tried “Allow Nulls” in the build datatable but to no effect
maybe you can elaborate more on the scenario and share also with us of
what you have done so far
and expected output example / sample
ill add another reply up tomorrow, unfortunately I cannot add the full XML as it contains sensitive information
So I have gotten so far but im stuck again
I have a for each loop running through the “pair:ApplicationCorrespondenceData”
but some of them have 2 sets of DocumentData.
Im writing to a datatable, so I would need the header data the same for each row, but the doc data on seperate rows.
I’d have to loop again, but how do I do this
as far we understand your question looping as mentioned above should be doable as well.
we can also navigate from one to another XElement e.g. to the parent
in such scenarios we can collect data step by step and add it afterwards to the datatable. E.g drNew = DataTable.NewRow and succesive population of drNew during the different nested loops
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.