以编程方式生成 XBRL 文档:使用模板还是库?
我正在开发一个财务应用程序,其中一项功能是生成 XBRL(可扩展业务报告语言)文档。如果您熟悉 XBRL 实例文档,您可能会意识到它们通常引用大量模式。使用(商业)库生成这些 XBRL 实例通常更容易。
使用案例:设计一个 Web 表单,供用户填写各个字段。使用用户输入生成有效的 XBRL 实例文档。
我们的平台:C# & .Net
我的问题:
您使用过任何(商业)库吗?您会推荐哪一个来生成“年度财务报表”? Altova MapForce 似乎占据主导地位。
避免使用(商业)库的粗略解决方法:
- 选择有效的实例文档,清除所有数据并将 XBRL (XML) 文件存储为模板。
- 使用 XSLT 将模板呈现给用户。收集用户输入并使用 .Net 中的标准 XML 库填写 XBRL
您会推荐此解决方法吗?为什么&为什么不呢?
任何意见将不胜感激:)
I am working on a financial application and one of the functionality is to generate XBRL (eXtensible Business Reporting Language) document. If you are familiar with XBRL instance documents, you might be aware that they typically refer to a large number of schemas. It is usually easier to generate these XBRL instances using (commecial) libraries.
Use case: Design a web form for the users to fill in the various fields.Generate a valid XBRL instance document using the user input.
Our platform: C# & .Net
My questions:
Have you used any of the (commercial) libraries? Which one would you recommend for generating 'yearly financial statements'? Altova MapForce seems to be dominant player.
A crude workaround to avoid using (commecial) libraries:
- Select a valid instance document, clear all the data and store the XBRL (XML) file as a template.
- Render the template to the user using XSLT. Collect user input and fill in the XBRL using standard XML libraries in .Net
Would you recommend this workaround? Why & why not?
Any input will be greatly appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
现在,我使用第二种方法的变体。我有一个模板,我可以解析它并用数据填充,这要归功于标准 XML 库(在我的例子中是 C libxml)。
拥有模板的想法有助于生成有效的 XBRL,但我认为 XSLT 非常复杂,而且通常是有限的,我更喜欢使用真正的编程语言(在我的例子中是 python,但也可能是 C# .net)
在商业工具上前面:
第三种方法是仅使用 XML 库以编程方式生成 XBRL 实例。毕竟,XBRL 就是 XML。
Right now, I use a variation of the second approach. I have a template, that I parse and populate with data, thanks to a standard XML library (in my case C libxml).
The idea of having a template helps to produce valid XBRL, but I think XSLT is very complex, and usually limited, I prefer to use a real programming language (python in my case, but that could be C# .net)
On the commercial tools front:
A third approach is to generate a XBRL instance only programmatically, with a XML Library. XBRL is XML, after all.
我首先会退后一步,重新考虑用例。除了财务报表的脚注和较长的段落大小的注释之外,财务报告通常还包含数百到数千个单独的数字事实。您真的希望用户坐在 Web 表单前并重新输入此业务关键数据吗?
实际上,这些数据存在于数据库中,将其输入 XBRL 的最安全方法是连接到该数据库。
正如开头问题中所指出的,XBRL 使用大量模式,最重要的分类模式可以包含数千个元素定义。标准 XML 工具上的 UI 并未针对这种情况进行优化,但内部帐户标识符和基本分类标记之间的映射是该流程最重要的用例之一。再次考虑将此映射存储在财务数据库中,因为它是业务关键数据。
I would start by stepping back and reconsidering the use case. Financial reports usually contain hundreds to thousands of individual numeric facts, in addition to footnotes and longer, paragraph sized notes to the financial statements. Do you really want a user to sit in front of a web form and re-key this business critical data?
Realistically, this data exists in a database, and the safest way to get it into XBRL is a connector to that database.
As noted in the opening question, XBRL uses a large number of schemas, and the most important taxonomy schemas can contain thousands of element definitions. The UI on standard XML tools is not optimized for this situation, but mapping between the internal account identifiers and the base taxonomy tags is one of the most important use cases of the process. Again, consider storing this mapping in your financial database because it is business critical data.
在商业库中,Gepio 是 .NET 平台的明确选择,而且它是开源的。
如果用户必须填写数据,那么您的粗略解决方法是正确的。您可以使用 XForms 来允许用户直接编辑空白 XML。大多数 XML 数据库都包含 XForms 支持。
如果您不打算使用 XML DB,则可以使用 XSLTForms,这是一个几乎可以在任何浏览器。
On commercial libraries, Gepsio is the clear choice for .NET platform and it's Open Source.
If the user has to fill the data, your crude workaround is right. You can use XForms to allow the user to edit the blank XML directly. Most XML Databases include XForms support.
If you are not going to use an XML DB, you can use XSLTForms, an XForms plugin that runs in almost any browser.
要创建 xbrl 文件,我将使用模板来避免重新编译解决方案(如果不需要)。
到目前为止,xslt 为我做了很好的工作。
生成 xbrl 的 xslt 示例如下所示:
最近我一直在创建大型 xbrl 文件(500+ mb 大小),并且使用 xslt 仍然在时间方面做得很好。
尽管为了使用这些文件,最好构建临时算法来搜索和查找您要查找的内容。使用 xpath 会使它太慢,所以最好是构建一个定制的算法来获得你需要的东西。
To create a xbrl file I would use a template to avoid to recompile the solution if I don't have to.
So far, xslt have done a good job for me.
a xslt sample to produce xbrl looks like this:
Recently i have been creating big xbrl files (500+ mb size) and using xslt still does a good job time wise.
Although for consuming these files, best to build and adhoc algorithm to search and find what you look for. Using xpath make it too slow, so the best is to build a tailored algorithm to get what you need.
我目前正在开发一个使用和生成大型 Xbrl 文档的项目。
对于生成,我们目前使用 Altova MapForce 来设计地图,并使用 Altova FlowForce 和 Altova MapForce Server 来执行从 Xml 到 Xbrl 的映射。 MapForce 的性能相当不错,但 FlowForce 在处理大量文件时有点笨拙。
对于您的用例,我不会沉迷于数据收集,MapForce 可以从文本文件 (csv) 或 xml 进行映射。将数据存入数据库后,生成输入文档(在 C# 中为 XmlDocument),并让 MapForce 在 Xbrl 中生成输出文档。
I am currently working on a project which is consuming and generating large Xbrl documents.
For generation we are currently using Altova MapForce for designing the maps and Altova FlowForce and Altova MapForce Server for executing the mapping from Xml to Xbrl. Performance of MapForce is quite good, but FlowForce is a bit clunky when working with large numbers of files.
For your use case, I would not get hung up on the data collection, MapForce can map from text files (csv) or xml. Once you have your data in a database, generate a input document (in C# as and XmlDocument) and let MapForce produce the output document in Xbrl.