readsdmx__read_sdmx <- function (path, destfile = tempfile(fileext = ".xml"), quiet = TRUE, 
                                 method = "libcurl", mode = "w", ...) {
  
  # check: https://data-explorer.oecd.org/vis?df[ds]=DisseminateFinalDMZ&df[id]=DSD_NAMAIN1%40DF_QNA_EXPENDITURE_INDICES&df[ag]=OECD.SDD.NAD&df[vs]=1.1&dq=Q............&lom=LASTNPERIODS&lo=5&to[TIME_PERIOD]=false
  url <- "https://sdmx.oecd.org/public/rest/data/OECD.SDD.NAD,DSD_NAMAIN1@DF_QNA_EXPENDITURE_INDICES,1.1/Q............"
  path <- url
  destfile <- tempfile(fileext = ".xml")
  quiet <- TRUE
  method <- "libcurl"
  mode <- "w"
  
  if (readsdmx:::is_url(path)) {
    if (!capabilities("libcurl") && method == "libcurl"){
      method <- "auto"
    } 
    # df <- download.file(path, destfile, method, quiet, mode, ...)
    df <- download.file(path, destfile, method, quiet, mode)
    stopifnot(df == 0L)
    path <- destfile
  }
  stopifnot(file.exists(path))
  path <- normalizePath(path)
  d <- readsdmx:::read_sdmx_(path)
  data <- as.data.frame(d, stringsAsFactors = FALSE)

}
