Saturday, August 24, 2013
Thursday, June 6, 2013
I have, after a long break, checked in a pretty significant changeset for Gepsio that will change how consumers check the validity of a loaded XBRL document. The idea was originally discussed in this post, and, after some work, this scheme has been put into place.
The XbrlException class will no longer be supported with this change, and code currently making use of this exception class will have to change to remove it. Instead of catching an XbrlException instance when a document is loaded, do the following:
- Load an XBRL document as usual.
- Check the state of the XbrlDocument’s IsValid property. The IsValid property will be true if the document is valid according to XBRL conformance rules and false if the document is not valid.
- If the document is not valid, the XbrlDocument’s ValidationErrors collection will contain more information on the validation errors. This collection is a .NET collection of ValidationError objects, each of which contains a property called Message which describes the error.
Using C#, XBRL document loading and validation code will look something like this:
if(newXbrlDocument.IsValid == false)
foreach (var currentValidationError in xbrlDoc.ValidationErrors)
var validationMessage = currentValidationError.Message;
// display message
The ValidationError class is a base class, and, depending on the error, certain derived classes may contain more context to describe the error. For example, validation errors in calculation linkbases might reference the contributing facts and the summation fact involved in the failed calculation.
The original XbrlException scheme caused Gepsio to stop validating an XBRL document as soon as the first error was found. This new scheme allows Gepsio to completely validate an XBRL document and report on all of the errors in one pass.
This change will ship with the next CTP, which I hope to release soon. It’s been a while.