R – Simple Recursive XML Parsing
This is intended for those who are starting out in R and interested in parsing an XML document recursively. It uses DT Lang’s XML package.
If you want to just read certain types of nodes, then XPATH is great. This document by DT Lang is perfect for that.
However, if you want to read the whole document, then you have to recursively visit every node. Here’s the way I ended up doing it. The generic function visitNode could be useful if you are just starting out reading XML in R.
The full code, along with a sample XML file to test it is here.
To leave a comment
for the author, please follow the link and comment on their blog: Doodling with Data
offers daily e-mail updates
news and tutorials
on topics such as: Data science
, Big Data, R jobs
, visualization (ggplot2
), programming (RStudio
, Web Scraping
) statistics (regression
, time series
) and more...
If you got this far, why not subscribe for updates
from the site? Choose your flavor: e-mail
, or facebook