How XBRL Works- A Technical Breakdown

In the realm of business reporting, data integrity and transparency are paramount. Enter eXtensible Business Reporting Language (XBRL), a standardized language designed to simplify the exchange of business information.  

Here we talk about the intricacies of XBRL, explaining its structure, functionality, and the technicalities that make it a cornerstone in modern financial reporting, complete with code examples to illustrate its implementation.

What is XBRL?

XBRL stands for eXtensible Business Reporting Language. It is an XML-based framework developed to standardize the way financial data is communicated between businesses, regulators, and investors. By using a common format, XBRL ensures that financial information is accurate, timely, and easily understandable, regardless of the platform or system used. 

How XBRL Works?

XBRL operates by tagging each piece of data with metadata that describes its meaning and context. These tags follow a standardized taxonomy, which ensures consistency across different reports and platforms.  

 

Here’s a step-by-step breakdown of how XBRL works: 

 Taxonomies: Taxonomies are dictionaries of financial reporting terms. They define the concepts and relationships used in XBRL documents. For instance, a taxonomy might include definitions for terms like “Net Income,” “Assets,” and “Liabilities,” along with their relationships and calculation rules. 

 Instance Documents: These are the actual financial reports formatted in XBRL. An instance document contains the data tagged according to the taxonomy. For example, a balance sheet in XBRL format will have each line item tagged with the appropriate taxonomy elements. 

 XBRL Specification: This is the technical framework that outlines how XBRL tags should be created, used, and validated. It ensures that XBRL documents are consistent and can be processed by any XBRL-compliant software. 

 

A Detailed Technical Breakdown

To understand the technical nuances of XBRL, let’s dive deeper into its core components: 

Elements and Attributes:

  • Elements represent the data points in XBRL, such as “Revenue” or “Net Income.” Each element has attributes that provide additional information, such as the period of time the data covers, or the currency used. 
  • Attributes might include details like the unit of measurement, the precision of the value, and the context in which the data applies.

Contexts:  

  • Contexts define the circumstances under which data is valid. For example, the context for a financial figure might include the reporting period (e.g., Q1 2024) and the entity to which it applies (e.g., Company ABC).

Units and Measures:  

  • Units define the measurement units for numerical data, such as “USD” for U.S. dollars or “shares” for the number of shares outstanding. Measures ensure that data is accurately and consistently represented.

Linkbases:  

  • Linkbases are files that define relationships between elements in a taxonomy. There are different types of linkbases, including:
  1. Label Linkbase: Provides human-readable labels for elements. 
  2. Presentation Linkbase: Defines how elements are presented in reports. 
  3. Calculation Linkbase: Specifies arithmetic relationships between elements. 
  4. Definition Linkbase: Describes other relationships and constraints. 

Let’s look at some code examples to illustrate how XBRL works in practice. We’ll use Python for parsing and creating XBRL documents, and HTML to display the data. 

Let’s look at some code examples to illustrate how XBRL works in practice. We’ll use Python for parsing and creating XBRL documents, and HTML to display the data. 

 Creating a Simple XBRL Instance Document 

 Here, we’ll create a simple XBRL instance document with a balance sheet item. 

 python 

import xml.etree.ElementTree as ET 

 # Define namespaces 

namespaces = { 

    ‘xbrli’: ‘http://www.xbrl.org/2003/instance’, 

    ‘xbrl’: ‘http://www.xbrl.org/2003/instance’ 

 

# Create the root element 

root = ET.Element(‘xbrli:xbrl’, xmlns=”http://www.xbrl.org/2003/instance”) 

# Create context element 

context = ET.SubElement(root, ‘xbrli:context’, id=”C1″) 

entity = ET.SubElement(context, ‘xbrli:entity’) 

identifier = ET.SubElement(entity, ‘xbrli:identifier’, scheme=”http://www.example.com”) 

identifier.text = ‘CompanyABC’ 

period = ET.SubElement(context, ‘xbrli:period’) 

start_date = ET.SubElement(period, ‘xbrli:startDate’) 

start_date.text = ‘2024-01-01’ 

end_date = ET.SubElement(period, ‘xbrli:endDate’) 

end_date.text = ‘2024-03-31’ 

# Create unit element 

unit = ET.SubElement(root, ‘xbrli:unit’, id=”U1″) 

measure = ET.SubElement(unit, ‘xbrli:measure’) 

measure.text = ‘iso4217:USD’ 

# Create balance sheet item 

element = ET.SubElement(root, ‘xbrl:Assets’, contextRef=”C1″, unitRef=”U1″) 

element.text = ‘1000000’ 

# Convert to a string and print 

tree = ET.ElementTree(root) 

ET.indent(tree, space=”  “, level=0) 

tree.write(“simple_xbrl.xml”, encoding=”utf-8″, xml_declaration=True) 

# Print out the XML string 

with open(“simple_xbrl.xml”, “r”) as file: 

    print(file.read())  

  1. Parsing an XBRL Document and Displaying in HTML 

 Let’s parse an existing XBRL document to extract some financial data and display it using HTML. 

 python 

import xml.etree.ElementTree as ET 

# Load the XBRL document 

tree = ET.parse(‘simple_xbrl.xml’) 

root = tree.getroot() 

# Define namespaces 

namespaces = { 

    ‘xbrli’: ‘http://www.xbrl.org/2003/instance’, 

    ‘xbrl’: ‘http://www.xbrl.org/2003/instance’ 

# Extract context information 

contexts = root.findall(‘xbrli:context’, namespaces) 

context_info = [] 

for context in contexts: 

    entity = context.find(‘xbrli:entity/xbrli:identifier’, namespaces).text 

    period = context.find(‘xbrli:period’, namespaces) 

    start_date = period.find(‘xbrli:startDate’, namespaces).text 

    end_date = period.find(‘xbrli:endDate’, namespaces).text 

    context_info.append((entity, start_date, end_date)) 

# Extract financial data 

assets = root.find(‘xbrl:Assets’, namespaces).text 

# Generate HTML 

html_content = f””” 

<!DOCTYPE html> 

<html> 

<head> 

    <title>XBRL Report</title> 

</head> 

<body> 

    <h1>Company Financial Report</h1> 

    <h2>Context Information</h2> 

    <table border=”1″> 

        <tr> 

            <th>Entity</th> 

            <th>Start Date</th> 

            <th>End Date</th> 

        </tr> 

“”” 

for entity, start_date, end_date in context_info: 

    html_content += f””” 

        <tr> 

            <td>{entity}</td> 

            <td>{start_date}</td> 

            <td>{end_date}</td> 

        </tr> 

    “”” 

 

html_content += f””” 

    </table> 

    <h2>Financial Data</h2> 

    <p>Assets: {assets} USD</p> 

</body> 

</html> 

“”” 

# Save to an HTML file 

with open(‘report.html’, ‘w’) as file: 

    file.write(html_content) 

print(“HTML report generated successfully.”) 

HTML Display 

The generated HTML file (report.html) will look like this when opened in a web browser: 

html 

<!DOCTYPE html> 

<html> 

<head> 

    <title>XBRL Report</title> 

</head> 

<body> 

    <h1>Company Financial Report</h1> 

    <h2>Context Information</h2> 

    <table border=”1″> 

        <tr> 

            <th>Entity</th> 

            <th>Start Date</th> 

            <th>End Date</th> 

        </tr> 

        <tr> 

            <td>CompanyABC</td> 

            <td>2024-01-01</td> 

            <td>2024-03-31</td> 

        </tr> 

    </table> 

    <h2>Financial Data</h2> 

    <p>Assets: 1000000 USD</p> 

</body> 

</html> 

 

This HTML code displays the context information and the financial data extracted from the XBRL document in a tabular format. 

XBRL represents a significant advancement in the standardization of financial reporting. By providing a common language for business information, it enhances transparency, accuracy, and efficiency in financial communications. Understanding the technical aspects of XBRL, from taxonomies to linkbases, is crucial for leveraging its full potential. As the world of business continues to evolve, XBRL stands as a testament to the power of standardization in improving financial reporting and analysis. 

In an era where data-driven decision-making is paramount, XBRL not only facilitates the seamless exchange of information but also empowers stakeholders with the tools they need to make informed decisions. Embracing XBRL is a step toward a more transparent and interconnected financial world. 

Leave a Reply

Your email address will not be published. Required fields are marked *


Subsidiaries

IRIS Regtech Sdn. Bhd. (Malaysia)

IRIS Business Services (Asia) Pte. Ltd., Singapore

IRIS Business Services, LLC, USA

Atanou S.r.l. (Italy)

IRIS Logix Solutions Private Limited, India

Follow Us On Social
Stay connected and follow us on social media for the latest updates and news.
Avantage
Headquarters
Visualize quality intellectual capital without superior collaboration and idea sharing installed base portals.
Our locations
Where to find us?
https://www.irisbusiness.com/wp-content/uploads/2020/04/img-footer-map-1.png
Get in touch
Avantage Social links
Taking seamless key performance indicators offline to maximise the long tail.

©2024 IRIS Business Services. All rights reserved.
Read our Privacy Policy, Cookies Policy, and Terms & Conditions for more.