Hi,
I have the following xml output.
I want to convert that into a data table with 2 columns “PhoneNumber” and “Status” for all message headers without using for each.
Please let me know if anybody has a solution.
Thanks,
Amrutha
Hi,
Can you share your xml file as attachment?
Regards,
Hi,
The following will work, if input xml file is same as yours.
dtResult = xDoc.Descendants(xns+"messageheader").Select(Function(x) dtResult.LoadDataRow({x.Element(xns+"to").Element(xns+"phonenumber").Value,x.Element(xns+"status").Value},False)).CopyToDataTable()
Sample20221211-3aL.zip (3.3 KB)
Regards,
Thanks @Yoichi. The solution you provided gives the desired result.
Regards,
Amrutha