Validate Financial Reporting Files via Python

Validating financial report formats including XBRL and iXBRL within Python based applications.


Aspose.Finance for Python via .NET is a feature rich, extensible and easy to use financial report processing API. Developers can easily load, validate, view or create XBRL and iXBRL formats for financial and business solutions. API provides XbrlDocument class and InlineXbrlDocument class for loading XBRL and iXBRL files.

Validate XBRL Document

Validation of XBRL file is needed for a number of cases such as to check data is in right structure and format. To validate XBLR documents, Firstly use XbrlDocument class to load the XBRL file. To use the validate method of XbrlInstance class, firstly intialize the XbrlInstanceCollection with XbrlDocument object XbrlInstances. Iterate through each XbrlInstance.ValidationErrors to get the right error code and act accordingly by printing the customized error messages on console or writing within a file.

Python Code to Validate XBRL File

Validate iXBRL Document

For iXLRB validation, load it via InlineXbrlDocument class and use its validate() method. In ValidationErrorCode enumeration, validation error codes are defined for each validation rule. Few of codes are ContextPeriodNoStartTime, ContextPeriodNoEndTime, ContextPeriodStartAfterEnd, ContextInstantNoTime, ContextScenarioXbrlNamespace, ContextScenarioXbrlSubstitutionGroup etc. Developers can debug and display codes as of end users or can show the direction for resolving the issue.

Python Code to Validate iXBRL Document