As a brief follow-up to my post on microformats and Open XML, I’d like to show a slightly different (and, frankly, more common) variation on using custom XML parts.
Many organizations and industries have custom schemas that they’ve standardized upon. A good example is XBRL (eXtensible Business Reporting Language), a set of XML-based vocabularies for describing the types of information that appear on financial reports. Let’s take a look at how an Open XML document might handle XBRL data.
Consider the sample XBRL instance posted on XBRL.org here:
Let’s consider a hypothetical scenario where an analyst can get XML documents like this for various companies they’re tracking. And let’s say the analyst has a standardized look and feel for presenting this information. How might Open XML help them create a solution that can quickly and easily display any company’s financial data in their standardized format? To keep this example simple, let’s say that our goal is to product reports that look like the human-readable version of that same data as presented on the XBRL.org site.
We start from our chunk of XML containing the XBRL-coded financial information, which might look like this:
Then we create an Open XML document and insert content controls for the nodes that we want to display in our report. The above XML goes into the document as a custom XML part, and after binding the nodes (as described in my previous post), the resulting document looks something like this:
It’s nothing fancy (I’ve deliberately kept this example very simple), but my goal here was to show the basic architecture of a typical data-driven report that displays data based on a custom schema. The above document (attached) has a nice clean custom XML part that only contains the XBRL data, and that part can be replaced easily by any programming environment that can deal with ZIP archives. Note that a full-blown XBRL implementation would probably include data-entry functionality and interactive analysis capabilities, and the sample shown here would just be one of many reporting options.