extract_toc | R Documentation |
Extracts the values of a node from the Eurostat XML Table of contents (TOC) file
extract_toc(ns)
ns |
an XML node set from the XML TOC file |
It is a sub-function to use in the get_eurostat_toc
function.
a character vector with all the values of the node set.
cfg<-get("cfg",envir=restatapi::.restatapi_env)
rav<-get("rav",envir=restatapi::.restatapi_env)
toc_endpoint<-eval(parse(text=paste0("cfg$TOC_ENDPOINT$'",rav,"'$ESTAT$xml")))
if (!(grepl("amzn|-aws|-azure ",Sys.info()['release']))) options(timeout=2)
tryCatch(xml_leafs<-xml2::xml_find_all(xml2::read_xml(toc_endpoint),".//nt:leaf"),
error = function(e) {xml_leafs<-""},
warning = function(w) {xml_leafs<-""})
if (exists("xml_leafs")){
if (Sys.info()[['sysname']]=='Windows'){
xml_node<-as.character(xml_leafs[1])
}else{
xml_node<-xml_leafs[1]
}
restatapi::extract_toc(xml_node)
}
options(timeout=60)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.