How to define Root and row element to generate xml from data table
Ideally you'd give us a reproducible example (reprex) of your issue as a starting point. A reprex makes it much easier for others to understand your issue and figure out how to help. A lack of a reprex just makes it much less likely others will reply.
There's a number of packages to help you parse XML,