Monday, January 3, 2011

XBRL Schemas Are Valid XML Schemas?

Way back when, when I started work on Gepsio, my initial XBRL research led me to believe that XBRL schemas were not W3C valid XML schemas. This led me to an implementation approach in which I built my own XBRL schema parser for use with Gepsio.

Now that I am older and wiser (OK, maybe just older), I am going to re-evaluate that position. I see that my as-yet-incomplete implementation of XBRL schema support within Gepsio is causing some bugs to be filed, which will lead to more code that must be written. If my initial assumption was incorrect, and all XBRL schemas are indeed W3C valid XML schemas, then all of this schema parsing and management code is a waste. It would make more sense to use the XmlSchema class in the .NET Framework and let it do all of my schema parsing and type management for Gepsio.

I’ll be taking some time this month to try and prove out the assumption that all XBRL schemas are valid W3C XML schemas. Here’s the approach I will be taking:

  • Retain the existing XbrlSchema class and related parsing and type management code.
  • Add a private field to the XbrlSchema class of type XmlSchema.
  • Along with all of the current work that Gepsio is doing with XbrlSchema, attempt to open up the same schema as a W3C XML Schema with the new XmlSchema member.
  • Run all of the Gepsio unit tests. If the XmlSchema-based parsing fails with a valid XBRL schema on any of the unit tests, then I will know that not all XBRL schemas are W3C XML schemas.

If, as I suspect, all XBRL schemas are indeed valid W3C SML schemas, then I can work to rip out the internal implementation of XbrlSchema and replace it with a new implementation that leverages XmlSchema rather than doing all of the parsing work myself. This will eliminate lots of unneeded schema management code and will keep things cleaner. In any case, the XbrlSchema class and its public interface will remain as is. Only its internal and private implementations will change so that it leverages the functionality in the .NET XmlSchema class. That would be fine with me; deleting dead code is always worthwhile.

3 comments:

  1. Jeff, I would be interested to know what the outcome of this exercise was. It sounds like a very interesting question and look forward to a follow-up post.

    ReplyDelete
  2. Hello sayanghosh,

    This was indeed successful. See the follow-up post at http://gepsio.blogspot.com/2011/01/xbrl-schema-support-refactoring-success.html.

    ReplyDelete
  3. My mistake, should have checked the follow-up post! For anyone else thinking about it, go straight to http://gepsio.blogspot.com/2011/01/xbrl-schema-support-refactoring-success.html

    ReplyDelete