CSV data source driver
The CSV Data Source Driver is a configurable generic driver to obtain data from comma separated files and create XBRL reports inside the automatization framework provided by the XBRL Mapper engine designed by Reporting Standard.
The XBRLmapper tool contains a simple GUI that is able to create mapping configuration files between columns in the CSV file and events in the XBRL template file. Advanced users can take advantage of editing the XML configuration files manually or creating their own editing applications.
The configuration file is provided during the driver declaration inside the instance document template file. See XBRL Template File#Definition_of_data_sources for more information. The driver class is com.ihr.xbrl.mapper.source.CSVDataSource
Sample CSV Driver data source declaration: <syntaxhighlight lang="xml">
<datasources> <source id="source0" class="com.ihr.xbrl.mapper.source.CSVDataSource" config="CSV-driver-config.xml"/> </datasources>
The configuration file must be valid according to a very simple XML Schema that has no namespace and that is published in the following official location: https://www.reportingstandard.com/schemas/source/XBRLDataSourceCSVMapSchema.xsd
Sample configuration file: <syntaxhighlight lang="xml"> <CSVConf
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation ="https://www.reportingstandard.com/schemas/source/XBRLDataSourceCSVMapSchema.xsd">
<decimals/> <formatValue>INF</formatValue> <map mapIdentifier="totalSalesConsolidatedIdentifier" columnName="totalSales" /> <map mapIdentifier="costOfSalesIdentifier" columnName="costOfSales" /> </CSVConf> </syntaxhighlight>
The example above shows the content of the mapping configuration file.
The root element is the CSVConf element. The content of the root element is:
- The <decimals/> element if the numeric elements in the CSV file are going to be serialized with the decimals XBRL attribute, or
- the <precision/> element if the numeric elements in the CSV file are going to be serialized with the precision XBRL attribute. followed by
- the formatValue element indicating the string INF or a number that will be the value of the decimals or precision attribute in the produced XBRL file, followed by a sequence of map elements.
- the map element is an empty element with two attributes. The mapIdentifier attribute contains a string that corresponds to the mapIdentifier string of existing events XBRL Template File#Events in the instance document template. The columnName attribute content is the column name inside the comma separated file.