extract_toc {restatapi} | R Documentation |
Extract the text of the table of contents from SDMX XML
Description
Extracts the values of a node from the Eurostat XML Table of contents (TOC) file
Usage
extract_toc(ns)
Arguments
ns |
an XML node set from the XML TOC file |
Details
It is a sub-function to use in the get_eurostat_toc
function.
Value
a character vector with all the values of the node set.
Examples
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)
[Package restatapi version 0.23.1 Index]