Based on this answer by Dirk Eddelbuettel I am trying to read an xml
file from a zip
archive for further processing. Apart from URL and filenames the only change to the code referenced is that I changed read.table
to xmlInternalTreeParse
.
library(XML)
temp <- tempfile()
download.file("http://epp.eurostat.ec.europa.eu/NavTree_prod/everybody/BulkDownloadListing?sort=1&downfile=data%2Fnrg_105a.sdmx.zip",temp)
doc <- xmlInternalTreeParse(unz(temp, "nrg_105a.dsd.xml"))
fileunlink(temp)
closeAllConnections()
However, this returns the following error:
Error in file.exists(file) : invalid 'file' argument
traceback()
shows that this is a function call from within the parser. So temp seems to be an inappropriate reference in this context. Is there a way to make this work?