Thursday, September 29, 2011

A Detailed View of Extensible Business Reporting Language Instance

Introduction: XBRL instance is the XML document that contains the real data in an XML format. This document expects a fundamental knowledge about XBRL, which you can read from my posts here. At this point, I will discuss about an instance document in detail.

Items and tuples: As I explained in my earlier article, items are the elements that are simpleType and tuples are the element that are complexType. For an element to be an item, it must be a globally declared element in the taxonomy schema in the substitution group of xbrli:item (xbrli to be bound to namespace URL http://www.xbrl.org/2003/instance). It is also mandatory that the type of an item is a simpleType.

simpleType and complexType: These are w3 schema syntax. A simpleType element can have only a value, but not sub-elements. On the other hand, complexType elements can have sub-elements.


In and XBRL instance document, an item must have a contextRef attribute. The value of the attribute is the id of the context to which the item is attached. I will describe contexts in this document very soon.

The root element of the XBRL instance document is always xbrli:xbrl, which has the following definition.

<schema targetNamespace="http://www.xbrl.org/2003/instance"

  xmlns="http://www.w3.org/2001/XMLSchema"

  xmlns:xbrli="http://www.xbrl.org/2003/instance"

  xmlns:link="http://www.xbrl.org/2003/linkbase"

  elementFormDefault="qualified">

 

  <element name="xbrl">

    <annotation>

      <documentation>

      XBRL instance root element.

      </documentation>

    </annotation>

    <complexType>

      <sequence>

        <element ref="link:schemaRef" minOccurs="1" maxOccurs="unbounded" />

        <element ref="link:linkbaseRef" minOccurs="0" maxOccurs="unbounded" />

        <element ref="link:roleRef" minOccurs="0" maxOccurs="unbounded" />

        <element ref="link:arcroleRef" minOccurs="0" maxOccurs="unbounded" />

        <choice minOccurs="0" maxOccurs="unbounded">

          <element ref="xbrli:item"/>

          <element ref="xbrli:tuple"/>

          <element ref="xbrli:context"/>

          <element ref="xbrli:unit"/>

          <element ref="link:footnoteLink"/>

        </choice>

      </sequence>

      <attribute name="id" type="ID" use="optional" />

      <anyAttribute namespace="http://www.w3.org/XML/1998/namespace"

        processContents="lax" />

    </complexType>

  </element>

 

</schema>


As you can see, the definition only allows a handful of elements in it. Now, by virtue of being in the substitution group of xbrli:item, items can appear inside the xbrl element. However, since all of them are globally declared elements, XBRL has got no mechanism to restrict the order of the independent items that come right under the root element. Items can also appear inside the tuples.

Tuples on the other hand are elements in the substitution group of xbrli:tuple and contain either items or tuples or both. A tuple's type is complexType. The complexType must be defined in a way so that only items and tuples can appear inside. More precisely though, the complexType itself can be any valid complexType, but the tuple occurring inside any XBRL instance is not allowed to have children other than items or tuples. Tuples are used to group the data that do not make sense individually and the same tuple element can be repeated in the same instance document with different items and tuples inside to represent different values for the group of data that it contains. In other words, think of a tuple elements in an instance as a single row in a table and the items inside the tuple are column of the table. So that each row has a different value for the same columns.

Unlike an item, a tuple does not have a contextRef attribute. Which means that the items inside a single tuple may actually belong in different contexts. However, it is customery not to include items from different timelines into a single tuple instance.

Watch It! Since the members of the tuple are items and all items are globally defined elements, it is possible to use an item independently even when a tuple is defined to contain it. Say for example, we have the DirectorName element inside the tuple DirectorDetails. Now, since DirectorName is an item, it is perfectly possible to use DirectorName as a top level item. But doing so would not make sense. It is normally customary for organizations not to accept such an instance that uses a tuple member item independently.


Context: The xbrli:context element provides some essential meta information about any item. The information include an identifier of the entity that the data is reported about, and the date (and possibly time) of the data being valid.context elements are created independently of the item instances and then referenced from each item fact through its contextRef attribute.

A context has mandatory elements entity and period. The entity has a sub-element identifier, the value of which is a representation of the entity for which data is being reported. The scheme attribute is a URL that signifies what is the meaning of the value of the identifier element. For example, if the values of the identifier element is a uniqueID, the scheme URL may be something like http://www.geekyarticles.com/uniqueID.

The period element in the context provides information about the time in which the data reported is valid. period can either have startDate and endDate element, or a single instant element. There is a much less used third possibility too namely a forever element, which is an empty element that says that the data is valid in any time.

periodType attribute must be used in the definition of an item element in the schema. The value of the periodType attribute is either a duration or instant. If it is duration, the context associated with a corresponding fact can have startDate and endDate elements, but never an instant element. On the other hand, if the periodType is instant, the corresponding context must have period element containing an instant element. However, forever element is allowed in both cases.

Extension points - segment and scenario: entity element can optionally contain a segment element and context element can optionally contain a scenario element. These elements are really extension points and are meant for extra metadata. The XBRL dimensions specification heavily uses these elements. These elements can contain any element.

Unit: All numeric facts (instances of numeric items) must specify a unitRef attribute which has the same value as the id attribute of a unit element. unit element is a very flexible way to define units. Compound units can be formed by multiplying or dividing simple units. The simplest form of unit will have only one child measure. The value of the measure element is a qualified name. For example, the following unit definition represents USD.

<unit id="u1">
    <measure xmlns:ISO4217="http://www.xbrl.org/2003/iso4217">ISO4217:USD</measure>
</unit>


If we specify more than one measure elements, the unit represented by each measure element will be multiplied. For example, the following may mean square meter.

<unit id="u3" xmlns:u="http://www.geekyarticles.com/unit">
    <measure>u:meter</measure>
    <measure>u:meter</measure>
</unit>


Now what if we need to divide a measure by another, for example what if we have to mention USD/share? We can use the divide element for this purpose.

<unit id="u6">
    <divide>
       <unitNumerator>
         <measure>ISO4217:USD</measure>
       </unitNumerator>
       <unitDenominator>
         <measure>xbrli:shares</measure>
       </unitDenominator>
    </divide>
</unit>


Both the unitNumerator and unitDenominator elements can have one or more measure elements. All items of type monetaryItemType or any type derived from monetaryItemType must have a unit, that has got only one measure element. The value of the measure element must have a prefix that is bound to the URL http://www.xbrl.org/2003/iso4217, and the local part must be any ISO4217 currency code. Also, all items of type sharesItemType or a type derive from sharesItemType must have unit xbrli:shares.

Watch it! What if we want to represent a value 33%? In XBRL, all values are reported without scaling, and this is no exception. 33% is 0.33 in absolute value and this gets reported in the instance document. The unit for percentage is xbrli:pure.


Footnote: Footnotes are additional human readable informatation attached to any element. Footnotes are specified using footnoteLink. These are the only extended links that are present in the instance document. The locators in footnote link must only point to the element in the current instance document. This will be guaranteed if the xlink:href attribute value starts with a hash. But, it is not a requirement as long as the xlink:href points to an element in the current document. The following is an example of a footnoteLink.

<g:abc id="g2" precision="4" unitRef="u1" contextRef="c1">2600</g:abc>


<link:footnoteLink  xlink:type="extended" xlink:title="1"
    xlink:role="http://www.xbrl.org/2003/role/link">

    <link:footnote
      xlink:type="resource"
      xlink:label="footnote1"
      xlink:role="http://www.xbrl.org/2003/role/footnote"
      xml:lang="en">This is a footnote</link:footnote>


    <link:loc xlink:type="locator" xlink:label="fact2" xlink:href="#g2"/>

    <link:footnoteArc
     xlink:type="arc"
     xlink:from="fact2" xlink:to="footnote1"
     xlink:title="view explanatory footnote"
     xlink:arcrole="http://www.xbrl.org/2003/arcrole/fact-footnote"/>

  </link:footnoteLink>


Here in this example, the footnote "This is a footnote" is provided for the element with id g2.

Now, what if we need to provide a footnote for an element that we do not want to report. For example, say we are not reporting the DirectorRenumeration, and we want to add a footnote explaining why we chose to refrain from reporting it. This problem is solved by xsi:nil attribute (the prefix xsi is bound to "http://www.w3.org/2001/XMLSchema-instance"). This optional attribute, when specified on an item, means that the element is explicitly refraining from reporting a value. The element content in this case must be empty. The following example shows how to do this.

<g:DirectorRenumeration id="g2" precision="4" unitRef="u1" contextRef="c1" xsi:nil="true" />


<link:footnoteLink  xlink:type="extended" xlink:title="1"
    xlink:role="http://www.xbrl.org/2003/role/link">

    <link:footnote
      xlink:type="resource"
      xlink:label="footnote1"
      xlink:role="http://www.xbrl.org/2003/role/footnote"
      xml:lang="en">This is not required as the director is not being paid</link:footnote>


    <link:loc xlink:type="locator" xlink:label="fact2" xlink:href="#g2"/>

    <link:footnoteArc
     xlink:type="arc"
     xlink:from="fact2" xlink:to="footnote1"
     xlink:title="view explanatory footnote"
     xlink:arcrole="http://www.xbrl.org/2003/arcrole/fact-footnote"/>

  </link:footnoteLink>


schemaRef and linkbaseRef: These simple links can be used to include schema or linkbase files in the DTS (which would be traversed for more files that are referenced from the schema). At least one schemaRef is mandatory in an instance document and must appear before any other elements under the xbrl element. The following shows an example of schemaRef element.

<link:schemaRef xlink:type="simple" xlink:href="entryPoint.xsd"/>

1 comments:

Alex Bandit said...

it is really awesome to discover your site on the web as it really those ones who are just starting to explore the topic professional translation services

Post a Comment