xbrl-rs: Parse and validate financial reports in Rust
Published on (2026-03-27).
XBRL is an XML-based standard used in financial reporting. With xbrl-rs you can parse instance documents, and validate them against a taxonomy.
An instance document contains the actual report in a flat structure. For example, to report the balance sheet of a company, the instance document contains facts, like the total assets and liabilities:
<xbrli:xbrl
xmlns:de-gaap-ci="http://www.xbrl.de/taxonomies/de-gaap-ci-2020-04-01">
<de-gaap-ci:bs.ass decimals="2" contextRef="I-CURRENT-YEAR" unitRef="EUR">100000.00</de-gaap-ci:bs.ass>
<de-gaap-ci:bs.ass.currAss decimals="2" contextRef="I-CURRENT-YEAR" unitRef="EUR">80000.00</de-gaap-ci:bs.ass.currAss>
<de-gaap-ci:bs.ass.fixAss decimals="2" contextRef="I-CURRENT-YEAR" unitRef="EUR">20000.00</de-gaap-ci:bs.ass.fixAss>
<de-gaap-ci:bs.eqLiab decimals="2" contextRef="I-CURRENT-YEAR" unitRef="EUR">100000.00</de-gaap-ci:bs.eqLiab>
<de-gaap-ci:bs.eqLiab.equity decimals="2" contextRef="I-CURRENT-YEAR" unitRef="EUR">50000.00</de-gaap-ci:bs.eqLiab.equity>
<de-gaap-ci:bs.eqLiab.liab decimals="2" contextRef="I-CURRENT-YEAR" unitRef="EUR">50000.00</de-gaap-ci:bs.eqLiab.liab>
</xbrli:xbrl>
In the case above, the referenced taxonomy is the Generally Accepted Accounting Principles (GAAP) in Germany. The taxonomy defines what can be reported and the relationship between these concepts. The concepts themselves are defined in XSD schema files, while the relationships are described in linkbases, which are simple XML files.
In the example above, the calculation linkbase defines how total assets and total liabilities are aggregated. Other linkbases include the presentation and label linkbases. The presentation linkbase encodes the hierarchical structure of concepts, while the label linkbase provides human-readable labels. This structure can be used to display the facts above as a labeled tree:
| Concept | Label | Value | Unit |
|---|---|---|---|
| bs | Balance sheet | - | - |
| bs.ass | Total assets | 100,000.00 | EUR |
| bs.ass.fixAss | Fixed assets | 20,000.00 | EUR |
| bs.ass.currAss | Current assets | 80,000.00 | EUR |
| bs.eqLiab | Total equity and liabilities | 100,000.00 | EUR |
| bs.eqLiab.equity | Equity | 50,000.00 | EUR |
| bs.eqLiab.liab | Liabilities | 50,000.00 | EUR |
The following features are supported by xbrl-rs:
- parsing XBRL instance, schema, and linkbase files
- validating an instance document against the taxonomy
- a view of the instance document
Technically, xbrl-rs uses quick-xml to parse XML files. Compared to the well-known Python library Arelle, there is a modest 10x speedup in parsing large taxonomies (around 50 MB of XML files) and a 400x speedup in validating instance documents. There is still room for performance improvements. For example, parsing large taxonomies containing 500+ files could be parallelized.
XBRL validation is compared against the XBRL 2.1 conformance test suite. Currently, xbrl-rs achieves 69% coverage
Check out the repo for more information: https://github.com/quambene/xbrl-rs.