Validate Financial Reporting Files via C#

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


Aspose.Finance for .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.

C# 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.

C# Code to Validate iXBRL Document