-
Notifications
You must be signed in to change notification settings - Fork 55
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
Error on load caused by unrecognized script tag #282
Comments
What browser are you using, and how are you accessing the file? Is it behind a web server, and what file extension does it have? The fact that this is happening makes me think that it's being treated as HTML rather than XHTML. We should still try to fix it, as we try to make the viewer work in both HTML and XHTML modes. |
After further tests I managed to create this iXBRL instance that triggers this issue. (It's a report package derived from the ESEF conformance suite 2021) As I suspected, the problem is caused by a namespace prefix, but the position of the declaration is important. But this one where the order of lines is different will not: |
I've confirmed that the order of the namespace declarations does seem to be important here. It appears that lxml uses the first prefix it finds for a given namespace when choosing which prefix to use for newly created elements, and there does not appear to be anyway to override this. Switching to |
I think I have found a way. If we use from lxml import etree
xml='''
<a:foo
xmlns:a="https://www.example.com"
xmlns="https://www.example.com"
>
</a:foo>
'''
x = etree.fromstring(xml)
e = etree.Element("{https://www.example.com}script", nsmap = { None: 'https://www.example.com' })
x.append(e)
print("Create then append: " + str(e.prefix))
e = etree.SubElement(x, '{https://www.example.com}script', nsmap = { None: 'https://www.example.com' })
print("Sub element: " + str(e.prefix))
print(etree.tostring(x, method="xml", xml_declaration=True, pretty_print=True).decode()) Produces:
|
…space-bug Ensure that <script> tags always use default namespace (#282)
Important:
I'm using the 1.0.3 release because it seems that newer versions do not work well with ESEF reports (but that's another issue).
I don't think the version difference is related with my current problem but it's worth mentioning.
Description
In certain conditions opening the viewer gives a
Could not find viewer data
error.Unfortunately I was not able to determine the root cause of the issue nor can I provide the relevant iXBRL instance, because it is an actual financial report which may not be public yet.
However I found out that the data is not detected because the <script> tag enclosing the JSON data is actually prefixed with the xhtml namespace:
I thought this was because this prefix is explicitly defined in the report...
... but I was not able to reproduce the problem that way.
(Edit: I tried creating a viewer after removing that xhtml namespace prefix declaration from the original report and it worked, so I guess that is the problem after all.
Still this case could be addressed.)
I suppose the problem could be fixed either when the viewer is created in Arelle...
... or in the javascript during the lookup for the
<script type="application/x.ixbrl-viewer+json">
(maybe by looking at thelocalName
rather than thetagName
?):Miscellaneous
I mentionned two people in the issue for review (because the last one I wrote is still open ;) ), I hope that's ok.
review:
@derekgengenbacher-wf @sagesmith-wf
The text was updated successfully, but these errors were encountered: