我想解析XBRL文件,比如这个one因此我发现this npm模块,声称能够解析XBRL文件。这是我实现的示例代码:用JS解析XBRL文件
var ParseXbrl = require('parse-xbrl');
ParseXbrl.parseStr('<?xml version="1.0" encoding="US-ASCII"?> <xbrli:xbrlxmlns:aapl="https://www.sec.gov/Archives/edgar/data/320193/000162828016020309/aapl-20160924.xml">').then(function(parsedString) {
console.log(parsedString);
});
但是它仅返回以下内容:
Field not found. is not a date
loaded EntityRegistrantName: Field not found.
loaded CurrentFiscalYearEndDate: Field not found.
loaded EntityCentralIndexKey: Field not found.
loaded EntityFilerCategory: Field not found.
loaded TradingSymbol: Field not found.
loaded DocumentPeriodEndDate: Field not found.
loaded DocumentFiscalYearFocus: Field not found.
loaded DocumentFiscalPeriodFocus: Field not found.
loaded DocumentFiscalYearFocusContext: Field not found.
loaded DocumentFiscalPeriodFocusContext: Field not found.
loaded DocumentType: Field not found.
Unhandled rejection No year end found.
我有我的怀疑,有一些错误的doocument本身,因为它是直接从美国证券交易委员会并且由于我测试了多个不同的文档(每个文档都有相同的低效结果),因此我的代码不正确,或者npm模块过时或出错。因此,我的问题是,我应该使用的正确代码是什么,或者说,我应该使用什么正确的npm模块(如果有的话)。
任何帮助,非常感谢。
你确定模块是否安装在本地? – Programah
是的,我通过IDE运行我的代码,并通过命令提示符安装我的模块 – BWP