Valideer XBRL bestanden via C#
Financiële rapporten valideren in XBRL-indeling zonder dat Microsoft Office of andere software hoeft te worden geïnstalleerd.
Hoe u XBRL bestanden kunt valideren
Volg de stappen in het codefragment of verbeter het naar gelang uw toepassingsbehoeften voor het valideren van uitbreidbare documenten in de taal voor bedrijfsrapportage XBRL. Zorg ervoor dat u valideringsvereisten hebt in uw toepassing.
- Laad XBRL bestand met XbrlDocument-klasse Voorbeeld.1. Om de geldigheid van het geladen bestand te controleren, zodat het moet overeenkomen met: XBRL specificatie 1. Gebruik . om de validiteit te controleren valideren() methode van XbrlInstance klas.
Validatievereiste:
Om door te gaan met het valideren van XBRL documenten, is .NET Finance API de belangrijkste vereiste die moet worden opgenomen in de aanvraag.
- Installeer het via de opdrachtregel als
nuget install Aspose.Finance
of via de Package Manager Console van Visual Studio metInstall-Package Aspose.Finance
. - U kunt ook het offline MSI-installatieprogramma of DLL’s in een ZIP-bestand downloaden van: downloads .
C# code om XBRL bestanden te valideren
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XbrlDocument xbrlDoc = new XbrlDocument(XbrlFilePath + @"IdScopeContextPeriodStartAfterEnd.xml"); | |
XbrlInstanceCollection xbrlInstances = xbrlDoc.XbrlInstances; | |
XbrlInstance xbrlInstance = xbrlInstances[0]; | |
xbrlInstance.Validate(); | |
if (xbrlInstance.ValidationErrors.Count > 0) | |
{ | |
foreach (ValidationError validationError in xbrlInstance.ValidationErrors) | |
{ | |
if(validationError.Code == ValidationErrorCode.ContextPeriodStartAfterEnd) | |
{ | |
ContextValidationError contextValidationError = validationError as ContextValidationError; | |
Console.WriteLine("Validation error: end date is before start date in context " + contextValidationError.Object.Id); | |
} | |
else | |
{ | |
Console.WriteLine("Find validation error:" + validationError.Message); | |
} | |
} | |
} |
Andere validatieopties
XBRL (Inline uitbreidbare taal voor bedrijfsrapportage)