XBRL Template File: Difference between revisions
Line 3: | Line 3: | ||
The XBRL Template file is an XML file that defines events in order to let drivers to capture data that will be used for the generation of a new XBRL report. | The XBRL Template file is an XML file that defines events in order to let drivers to capture data that will be used for the generation of a new XBRL report. | ||
The namespace definition of elements in the XBRL Template file is '''<nowiki>http://www.reportingstandard.com/map/ | The namespace definition of elements in the XBRL Template file is '''<nowiki>http://www.reportingstandard.com/map/2</nowiki>''' | ||
The official location for the schema that corresponds to the indicated namespace is '''<nowiki>http://www.reportingstandard.com/schemas/mapper/mapper-2009.xsd</nowiki>''' | The official location for the schema that corresponds to the indicated namespace is '''<nowiki>http://www.reportingstandard.com/schemas/mapper/mapper-2009.xsd</nowiki>''' |
Revision as of 19:11, 30 June 2009
Description
The XBRL Template file is an XML file that defines events in order to let drivers to capture data that will be used for the generation of a new XBRL report.
The namespace definition of elements in the XBRL Template file is http://www.reportingstandard.com/map/2
The official location for the schema that corresponds to the indicated namespace is http://www.reportingstandard.com/schemas/mapper/mapper-2009.xsd
Sample file
<syntaxhighlight lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <xbrlMap xmlns="http://www.reportingstandard.com/map/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.reportingstandard.com/map/1 http://www.reportingstandard.com/schemas/mapper/mapper-2008.xsd" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xbrldi="http://xbrl.org/2006/xbrldi">
<datasources> <source id="source0" class="com.ihr.xbrl.mapper.source.StaticSource"/> </datasources>
<instance> <dts> <file>taxonomy.xsd</file> </dts> <contexts> <scheme>http://www.xbrl.org/companyName</scheme> <company>The Sample Company Name</company> <instantPolicy>now</instantPolicy> <startDatePolicy>instant</startDatePolicy> <endDatePolicy>startDate+P1Y</endDatePolicy>
<xbrli:context id="ctx0i"> <xbrli:entity> <xbrli:identifier scheme="_">_</xbrli:identifier> </xbrli:entity> <xbrli:period> <xbrli:instant>0001-01-01</xbrli:instant> </xbrli:period> </xbrli:context>
<xbrli:context id="ctx0d"> <xbrli:entity> <xbrli:identifier scheme="_">_</xbrli:identifier> </xbrli:entity> <xbrli:period> <xbrli:startDate>0001-01-01</xbrli:startDate> <xbrli:endDate>0001-01-01</xbrli:endDate> </xbrli:period> </xbrli:context> </contexts>
<units> <xbrli:unit id="EUR"> <xbrli:measure xmlns:iso4217="http://www.xbrl.org/2003/iso4217">iso4217:EUR</xbrli:measure> </xbrli:unit> </units>
<facts xmlns:tx="http://taxonomy.com/example"> <item sourceRef="source0" contextRef="ctx0i" mapIdentifier="identifier0" concept="tx:A" unitRef="EUR"/> <item sourceRef="source0" contextRef="ctx0d" mapIdentifier="identifier1" concept="tx:B" multi="Single" unitRef="EUR"/> <tuple concept="tx:U"> <item sourceRef="source0" contextRef="ctx0d" mapIdentifier="identifier2" concept="tx:C" multi="1"/> <item sourceRef="source0" contextRef="ctx0d" mapIdentifier="identifier3" concept="tx:D" multi="Single"/> <item sourceRef="source0" contextRef="ctx0d" mapIdentifier="identifier4" concept="tx:E" multi="All" unitRef="EUR"/> </tuple> </facts> </instance> </xbrlMap>
</syntaxhighlight>
Elements
The root element is xbrlMap
The content of the xbrlMap element is divided in two sections.
- Definition of data sources
- Event definitions and associated metadata
Both sections are required in a mapping file and that must occurs only once
Definition of data sources
Data sources are defined using source elements as children of the datasources element.
The source element is an empty element that has three attributes:
- Required id attribute. Used by item and tuple events later in order to identify the source they are linked with.
- Required class attribute. Used to indicate the driver class. The driver class must be instantiated at runtime (in a dll or in the classpath) and must implement the interface defined in the XBRLDataSource interface.
- Optional config attribute. Used to point to a file with configuration information for the driver indicated in the class attribute. The content may be a URI relative to the URI of the XBRL Template File and it is resolved using xml:base if it is indicated in the source element or any of it ancestors.
A sample datasources section where two data sources are defined. One is a web form, the other is a connection to a database that requires a configuration file called SQLMapperDriverConfig.xml and is located in the same folder as the XBRL Template file: <syntaxhighlight lang="xml">
<datasources> <source id="form" class="com.ihr.xbrl.mapper.source.WebFormDataSource"/> <source id="sql" class="com.ihr.xbrl.mapper.source.SQLDataSource" config="SQLMapperDriverConfig.xml"/> </datasources>
</syntaxhighlight>
Definition of events
The xbrlMap root element must have an instance element that in turn contains four sub-sections:
- The definition of the instance DTS
- The definition of the contexts templates
- The definition of the units
- The definition of the facts (Here is where the real events are defined. The previous three sections are just meta-data in order to facilitate the definition of the events)
The instance DTS
The instance DTS defines the schemas and linkbases that will be included in the new XBRL report in link:schemaRef and link:linkbaseRef elements. In the template file it is not required distinguishing between linkbase files and schema files. Both will be documented as simple files. The API will detect the file type and will include the required elements in the final XBRL report automatically.
The first child of the instance element must be a dts element that, in turn, contains an unlimited number of file elements each one of them indicating a relative or absolute file that will be included in the instance document during instance document generation phase. It is strongly recommended using official absolute file names of taxonomy or linkbase files in order to produce XBRL reports than can be opened everywhere. If you believe this is against performance, you may know that mapping external files on the Internet to local files is supported by almost all serious XBRL software vendors. Reporting Standard S.L. has implemented this feature using the XBRL Catalog and providing user friendly tools in order to help maintaining the local taxonomy catalog.
This is a sample dts section definition for the IFRS taxonomy: <syntaxhighlight lang="xml">
<dts> <file>http://xbrl.iasb.org/taxonomy/2009-04-01/ifrs/ias_1_2009-04-01/cal_ias_1_2009-04-01_role-210000.xml</file> <file>http://xbrl.iasb.org/taxonomy/2009-04-01/ifrs/label/lab_ifrs-en_2009-04-01.xml</file> <file>http://xbrl.iasb.org/taxonomy/2009-04-01/ifrs/ias_1_2009-04-01/pre_ias_1_2009-04-01_role-210000.xml</file> <file>http://xbrl.iasb.org/taxonomy/2009-04-01/ifrs/ias_1_2009-04-01/def_ias_1_2009-04-01_role-210000.xml</file> </dts>
</syntaxhighlight> Note that this example is not including the IFRS taxonomy schema. This is not an error. The required schema will be added automatically by the tool in order to produce a valid XBRL report during the document creation phase.