R-Project can be used to parse, build and validate XML files. The xml2 R library is the latest xml parsing library and should be used instead of the outdated xml library.
Install dev version from github:
# install.packages("devtools") devtools::install_github("r-lib/xml2")
Links
Manual: https://rdrr.io/cran/xml2/man/