Learn how to parse an XBRL document in Python : https://blog.aspose.com/parse-xbrl-in-python/
The following topics shall be covered in this article:
Learn how to parse an XBRL document in Python : https://blog.aspose.com/parse-xbrl-in-python/
The following topics shall be covered in this article:
| # 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) |