XBRL (eXtensible Business Reporting Language; XBRL 2.1, Recommendation 31 December 2003, errata 2013) carries financial statements as facts. Each fact is an element from a taxonomy (an XSD of concepts such as revenue), and points to a context (who and which period) and a unit (currency). This sample instance uses an invented BookNest taxonomy:
<!-- Sample data: an XBRL-style instance for an imaginary BookNest filing -->
<xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:iso4217="http://www.xbrl.org/2003/iso4217"
xmlns:bn="https://booknest.example.com/xbrl">
<link:schemaRef xlink:type="simple" xlink:href="booknest-taxonomy.xsd"/>
<xbrli:context id="FY2025">
<xbrli:entity><xbrli:identifier scheme="urn:bn">BN</xbrli:identifier></xbrli:entity>
<xbrli:period><xbrli:startDate>2025-01-01</xbrli:startDate>
<xbrli:endDate>2025-12-31</xbrli:endDate></xbrli:period></xbrli:context>
<xbrli:context id="AsOf2025">
<xbrli:entity><xbrli:identifier scheme="urn:bn">BN</xbrli:identifier></xbrli:entity>
<xbrli:period><xbrli:instant>2025-12-31</xbrli:instant></xbrli:period></xbrli:context>
<xbrli:unit id="USD"><xbrli:measure>iso4217:USD</xbrli:measure></xbrli:unit>
<bn:Revenue contextRef="FY2025" unitRef="USD" decimals="0">1284500</bn:Revenue>
<bn:NetIncome contextRef="FY2025" unitRef="USD" decimals="-3">96000</bn:NetIncome>
<bn:Inventory contextRef="AsOf2025" unitRef="USD" decimals="0">212300</bn:Inventory>
</xbrli:xbrl>from lxml import etree
X = {"x": "http://www.xbrl.org/2003/instance"}
doc = etree.parse("booknest-xbrl.xml")
periods = {c.get("id"): " to ".join(c.xpath(".//x:period/*/text()", namespaces=X))
for c in doc.xpath("//x:context", namespaces=X)}
for fact in doc.xpath("/x:xbrl/*[@contextRef]", namespaces=X): # every fact names a context
print(f"{etree.QName(fact).localname:10} {int(fact.text):>9,} {fact.get('unitRef')}"
f" {periods[fact.get('contextRef')]:24} decimals={fact.get('decimals')}")Revenue 1,284,500 USD 2025-01-01 to 2025-12-31 decimals=0 NetIncome 96,000 USD 2025-01-01 to 2025-12-31 decimals=-3 Inventory 212,300 USD 2025-12-31 decimals=0
decimals="-3" means accurate to thousands. Real filings use Inline XBRL, facts tagged inside an XHTML report, which the US SEC requires for 10-K and 10-Q filings under a 2018 rule (XBRL in Regulatory Filings). The open-source Arelle (github.com/Arelle/Arelle (https://github.com/Arelle/Arelle 247 )) validates filings against their taxonomies (not run here: the taxonomies are large).
XBRL
Extensible Business Reporting Language (XBRL) is an XML-based standard for reporting business information, such as financial statements, using standardized taxonomies (for example, IFRS).The following is an XBRL instance document reporting financial figures against an IFRS taxonomy.
<?xml version="1.0" encoding="UTF-8"?>
<xbrli:xbrl
xmlns:ifrs-gp="http://xbrl.iasb.org/int/fr/ifrs/gp/2005-05-15"
xmlns:iso4217="http://www.xbrl.org/2003/iso4217"
xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:xbrll="http://www.xbrl.org/2003/linkbase"
xmlns:xlink="http://www.w3.org/1999/xlink">
<xbrll:schemaRef
xbrll:href="http://www.org.com/xbrl/taxonomy"
xlink:type="simple"/>
<ifrs-gp:OtherOperatingIncomeTotalFinancialInstitutions
contextRef="J2004" decimals="0" unitRef="EUR">
38679000000
</ifrs-gp:OtherOperatingIncomeTotalFinancialInstitutions>
<ifrs-gp:OtherAdministrativeExpenses
contextRef="J2004" decimals="0" unitRef="EUR">
35996000000
</ifrs-gp:OtherAdministrativeExpenses>
<ifrs-gp:OtherOperatingExpenses
contextRef="J2004" decimals="0" unitRef="EUR">
870000000
</ifrs-gp:OtherOperatingExpenses>
...
<ifrs-gp:OtherOperatingIncomeTotalByNature
contextRef="J2004" decimals="0" unitRef="EUR">
10430000000
</ifrs-gp:OtherOperatingIncomeTotalByNature>
<xbrli:context id="BJ2004">
<xbrli:entity>
<xbrli:identifier scheme="www.iqinfo.com/xbrl">ACME</xbrli:identifier>
</xbrli:entity>
<xbrli:period>
<xbrli:instant>2004-01-01</xbrli:instant>
</xbrli:period>
</xbrli:context>
<xbrli:context id="EJ2004">
<xbrli:entity>
<xbrli:identifier scheme="www.iqinfo.com/xbrl">ACME</xbrli:identifier>
</xbrli:entity>
<xbrli:period>
<xbrli:instant>2004-12-31</xbrli:instant>
</xbrli:period>
</xbrli:context>
<xbrli:context id="J2004">
<xbrli:entity>
<xbrli:identifier scheme="www.iqinfo.com/xbrl">ACME</xbrli:identifier>
</xbrli:entity>
<xbrli:period>
<xbrli:startDate>2004-01-01</xbrli:startDate>
<xbrli:endDate>2004-12-31</xbrli:endDate>
</xbrli:period>
</xbrli:context>
<xbrli:unit id="EUR">
<xbrli:measure>iso4217:EUR</xbrli:measure>
</xbrli:unit>
</xbrli:xbrl>
(Courtesy of http://en.wikipedia.org/wiki/XBRL 30 )