XBRL package “Error in fileFromCache(file)”

岁酱吖の 提交于 2019-12-24 11:05:27

问题


I'm trying to read this xbrl file with R XBRL package...

https://www.cnmv.es/Portal/Consultas/wuc/DescargaXBRLIPP.ashx?t={77853e69-5deb-4bd5-acd4-3fb4715e2664}

...but when I download the file and run the code

xbrl.vars <- xbrlDoAll(inst, verbose=TRUE)

I get this error:

error in XBRL::xbrlParse(file) :
./ipp-enc-ind-2005-06-30.xsd./ipp-enc-con-2005-06-30.xsd does not exists. Aborting.

I suppose that the error is a problem with the ULR of the .xsd file. Is it possible to download the xsd files in a local directory and use them to read the .XBRL file? How can it be done?


回答1:


You can download a zip of the schemas from https://www.xbrl.es/informacion/ipp.html. After trying to parse the xbrl file using these, still got errors as there were still a few other files that were required. After downloading these, it does seem to parse, with warnings! I don't know if there is a more standard way to get these extra files, rather than one by one.

Download stuffs

# directory for files
dir.create("SOtemp")

# schemas
download.file("http://www.cnmv.es/IPP/taxonomia/2005-06-30/ipp_2005-06-30_v1.22.zip", "SOtemp/scheme.zip")
unzip("SOtemp/scheme.zip", exdir="SOtemp/")

# file
pth = "https://www.cnmv.es/Portal/Consultas/wuc/DescargaXBRLIPP.ashx?t=%7B77853e69-5deb-4bd5-acd4-3fb4715e2664%7D"
download.file(pth, destfile="SOtemp/2005-06-30/testSO.xml")


# extra stuffs that needed downloaded -- from R error messages
morePths <-c("https://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd",
             "https://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd",
             "www.xbrl.org/2003/xl-2003-12-31.xsd",
             "https://docs.oasis-open.org/emergency/edxl-have/cs01/xlink-2003-12-31.xsd")                 
mapply(download.file, morePths, destfile=file.path("SOtemp", "2005-06-30", basename(morePths)))

Now parse

library(XBRL)
out <- xbrlDoAll("SOtemp/2005-06-30/testSO.xml", cache.dir="naughtyCache/", prefix.out=NULL, verbose=TRUE)


来源:https://stackoverflow.com/questions/52170323/xbrl-package-error-in-filefromcachefile

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!