Skip to content

Instantly share code, notes, and snippets.

@aspose-finance-gists
Last active August 19, 2022 20:19
Show Gist options
  • Select an option

  • Save aspose-finance-gists/b027cbf2257a9475d3cce6f76949754c to your computer and use it in GitHub Desktop.

Select an option

Save aspose-finance-gists/b027cbf2257a9475d3cce6f76949754c to your computer and use it in GitHub Desktop.
Parse XBRL in Python | XBRL Python Parser
# This code eample demonstrates how to parse iXBRL document.
from aspose.finance.xbrl.inline import InlineXbrlDocument
# The path to the documents directory.
inputFile = "C:\\Files\\Finance\\Output.html"
# Load input file
document = InlineXbrlDocument(inputFile)
# Parse
inlineFacts = document.facts
contexts = document.contexts
units = document.units
# This code eample demonstrates how to parse XBRL document.
from aspose.finance.xbrl import XbrlDocument
# The path to the documents directory.
inputFile = "C:\\Files\\Finance\\sample.xbrl"
# Initialize XbrlDocument
document = XbrlDocument(inputFile)
# Get Instances
xbrlInstances = document.xbrl_instances
# Select specific instance
xbrlInstance = xbrlInstances[0]
# Parse
facts = xbrlInstance.facts
schemaRefs = xbrlInstance.schema_refs
contexts = xbrlInstance.contexts
units = xbrlInstance.units
# Show data
if contexts.length > 0:
for x in contexts:
print("id: " + x.id)
print("Entity Identifier : " + x.entity.identifier)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment