-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prefix 'ix' not found in prefix map #11
Comments
Seems like the instance document you are trying to parse is using the xmlns:ix="http://www.xbrl.org/2013/inlineXBRL" But since Which datasource are you using for the instance documents? |
Hello, I'm experiencing the same issue. The XBRL is from the DTA (Dutch Tax Authority). The XSD schema files are retrieved correctly. Attached is the XBRL but without any data. It seems to be the namespace that the DTA uses, bd-i. If I patch the module file 'instance.py' with the bd-i and iso2417 namespace, it unfortunately doesn't work. |
@tedjansen XBRL submissions from the SEC always contain a mapping between namespace and schema url in the taxonomy schema. Honestly I am not quite sure how to get the schema url for the namespace |
In this particular case the parser would just have to add a |
That seems unfortunately to be the way. I've parsed 4 different types of XBRL files locally (DCIT (Dutch Corporate Income Tax/VPB), DIT (Dutch Income Tax/IB), VAT (OB) and filed accounts (KVK deponering, Dutch GAAP,) but they all give an error when downloading any dictionary from nltaxonomie.nl. Would love to send in a PR, but I can't follow the exact error to where I should fix it. Besides the point that it seems a bit weird that there should be a reference in the software to supplement .xsd to the NL Taxonomy files. See below an example of a filed account statement with the same reference, but not the bd-i namespace. |
I found a mapping between namespace and schema url in the releasenotes of the sbr taxonomie (page 3): I am not quite sure if it is the best idea to add a fallback where the parser simply tries to add a In my opinion it would be nicer to add the ability to manually pass a dictionary to the parser, where you can define a mapping between namespace and schema url by yourself. This information can normally be found in the taxonomy architecture description. I will think about how this could be implemented in the next few days. |
@tedjansen I was able to parse the file you provided above by manually adding the missing mapping to the ns_schema_map attribute of the taxonomy module. Please install the latest version of py-xbrl ( import logging
from xbrl.cache import HttpCache
from xbrl.instance import XbrlInstance, XbrlParser
from xbrl.taxonomy import ns_schema_map
cache: HttpCache = HttpCache('./cache')
xbrlParser = XbrlParser(cache)
# add the missing namespace/schema_url mapping
ns_schema_map["http://www.nltaxonomie.nl/nt13/bd/20181212/dictionary/bd-data"] = \
"http://www.nltaxonomie.nl/nt13/bd/20181212/dictionary/bd-data.xsd"
# Todo: replace the file path
xbrl_url = './data/DTA/btw-gh.xml'
inst: XbrlInstance = xbrlParser.parse_instance_locally(xbrl_url) I know that this is not the prettiest solution but it should work for now. |
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. |
This is the full console log
`Traceback (most recent call last):
File "/home/samar/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 5, in
XbrlInstance = parse_ixbrl(ixbrl_path,cache)
File "/home/samar/anaconda3/lib/python3.8/site-packages/xbrl_parser/instance.py", line 389, in parse_ixbrl
xbrl_resources: ET.Element = root.find('.//ix:resources', ns_map)
File "/home/samar/anaconda3/lib/python3.8/xml/etree/ElementTree.py", line 649, in find
return self._root.find(path, namespaces)
File "/home/samar/anaconda3/lib/python3.8/xml/etree/ElementPath.py", line 389, in find
return next(iterfind(elem, path, namespaces), None)
File "/home/samar/anaconda3/lib/python3.8/xml/etree/ElementPath.py", line 368, in iterfind
selector.append(ops[token[0]](next, token))
File "/home/samar/anaconda3/lib/python3.8/xml/etree/ElementPath.py", line 184, in prepare_descendant
token = next()
File "/home/samar/anaconda3/lib/python3.8/xml/etree/ElementPath.py", line 86, in xpath_tokenizer
raise SyntaxError("prefix %r not found in prefix map" % prefix) from None
File "", line unknown
SyntaxError: prefix 'ix' not found in prefix map
`
The taxonomy was imported sucessfully.
The text was updated successfully, but these errors were encountered: