Should be doable, but not trivial ... https://github.com/i-akiya/R4DSXML does something similar, but throws and error similar to [this](https://github.com/i-akiya/R4DSXML/issues/3).