manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files
https://py-xbrl.readthedocs.io/en/latest/
GNU General Public License v3.0
100 stars 37 forks source link

Parser interprets .xbrl files as iXBRL #39

Closed manusimidt closed 3 years ago

manusimidt commented 3 years ago

Thx, that works if the file ends on .xml. The XBRL ends on .xbrl by default in The Netherlands, so the class automatically switches to the ixbrl processing variant. Unfortunately I get the same error, but by renaming it works.

_Originally posted by @tedjansen in https://github.com/manusimidt/xbrl_parser/issues/11#issuecomment-869211356_

manusimidt commented 3 years ago

The XbrlParser class had a little bug here. I fixed it and included the .xbrl extension to to the list of file formats for XBRL Instance documents. I will create a new minor version that includes this fix. You can either update your py-xbrl installation to 2.0.4 or directly use the parse_xbrl function of the instance module:

from xbrl.instance import parse_xbrl
cache: HttpCache = HttpCache('./cache')
inst = parse_xbrl('data/XBRL/0001384108-12-000004/v-20120331.xbrl', cache)