Extracts the values of a node from the Eurostat XML Table of contents (TOC) file

extract_toc(ns)

Arguments

ns

an XML node set from the XML TOC file

Value

a character vector with all the values of the node set.

Details

It is a sub-function to use in the get_eurostat_toc function.

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")))
# \donttest{
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)
}
#>                            title.en                                title.fr
#>                              <char>                                  <char>
#> 1: Current account - quarterly data Compte courant - données trimestrielles
#>                                    title.de        code lastUpdate lastModified
#>                                      <char>      <char>     <char>       <char>
#> 1: Leistungsbilanz - vierteljährliche Daten ei_bpm6ca_q 20.08.2024   20.08.2024
#>    dataStart dataEnd values unit.en unit.fr unit.de shortDescription.en
#>       <char>  <char> <char>  <char>  <char>  <char>              <char>
#> 1:   1992-Q1 2024-Q2 277755                                            
#>    shortDescription.fr shortDescription.de
#>                 <char>              <char>
#> 1:                                        
#>                                                     metadata.html
#>                                                            <char>
#> 1: https://ec.europa.eu/eurostat/cache/metadata/en/ei_bp_esms.htm
#>                                                                              metadata.sdmx
#>                                                                                     <char>
#> 1: https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/ei_bp_esms.sdmx.zip
#>                                                                                        downloadLink.tsv
#>                                                                                                  <char>
#> 1: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/EI_BPM6CA_Q?format=tsv&compressed=true
options(timeout=60)
# }