TOOLS: Header Creator
The objective of this document is to explain in short how to use the tool included in package headerCreator_v0.3_3 that can be used to create a container header document according to the CWA2 specification “Metadata container”.
Note these tools are part of a proof of concept, and still are in alpha state. These tools are provided “AS IS”, without warranty of any kind.
Restrictions
The tool is only able to create header structures complying with the BasicHeader schema. Extended headers may still be used by providing a header template for the tool. Extended headers shall comply with the rules provided in the CWA2 specification document.
Download the header creator executable file: headerCreatorTool_v0.3_3. Download the CWA2 test material: CWA2TestData_v0.3_3.
Prerequisites:
Before using this tool, you need:
- Java: If Java SE (Standard Edition) is not installed on your computer, download from oracle and install it. This package has been tested with java version 1.6.0, so this version or a newer one should be fine. If Java SE is installed on your computer, verify version (by using “java –version”), and if needed download and install a newer one;
- Package headerCreatorTool_v0.3_3.jar;
- Internet access to acquire the XML schema for validation (if referring to a schema online)
Creation of a header: headerCreator.LaunchHeaderCreator
To create a container, use the command:
java.exe –classpath headerCreatorTool_v0.3.jar headerCreatorTool.LaunchHeaderCreator -c containerdirectory -cid containerID -h headertemplate
Where:
- -c containerdirectory: file path in which the content of the pure container structure will be collected
- -cid containerID: an identifier for the container report data context
- -h headertemplate: file path in which the header template document resides. The header.xml document is fully specified in the CWA2 documentation. The header document can only be validated if the location of the XML schema is given in the “xsi:schemaLocation” attribute of the template header. If the header template is not provided, a header complying with the BasicHeaderOnly schema will be generated instead.
The basic functionalities of the header creator tool are:
- validation of the “headertemplate” i.e. validating the document against the XML schema defined in the “xsi:schemaLocation”
- copying every field that is provided in “headertemplate” and creating a new document called header.xml in “containerdirectory”,
- updating the header.xml document to match the file listings found in the “containerdirectory”.
All static field entries are copied from a template header xml file found at the location “headertemplate”. The tool generates the file (<File>) listings for the header.xml (see example below) according to the data aggregated prior in to the “containerdirectory”.
<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?><BasicHeaderOnly xmlns=”http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeaderOnly” xmlns:bh=”http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeader” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeaderOnly http://www.eurofiling.info/eu/fr/esrs/Header/BasicHeaderOnly.xsd”>
<bh:ReportDataContext>
<bh:ReportReferenceID>TestID</bh:ReportReferenceID>
</bh:ReportDataContext>
<bh:File>
<bh:FilePath>dataInstances_1/dataInstances_1_2/t-kri-corep-ca-2006-07-01_2.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/dataInstances_1_2/t-kri-corep-ci-2006-07-01_2.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/dataInstances_1_2/t-kri-corep-cs-2006-07-01_2.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/t-kri-corep-ca-2006-07-01.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/t-kri-corep-ci-2006-07-01.xbrl</bh:FilePath>
</bh:File>
<bh:File>
<bh:FilePath>dataInstances_1/t-kri-corep-cs-2006-07-01.xbrl</bh:FilePath>
</bh:File>
</BasicHeaderOnly>
Sample command
The following command creates a file called “header.xml” with the proper file listings into the directory located at C:\CWA2TestData_v0.3_3\headerCreator\in
“C:\Program Files\Java\jdk1.7.0_04\bin\java.exe” -server -classpath headerCreatorTool_v0.3_3.jar headerCreatorTool.LaunchHeaderCreator -h C:\CWA2TestData_v0.3_3\headertemplate.xml -c C:\CWA2TestData_v0.3_3\headerCreator\in -cid testID
Sample output
dec 07, 2013 3:06:23 PM. xmlTools.XMLTools validateXML
INFO: file:/C:/CWA2TestData_v0.3_3/headertemplate.xml is valid.
dec 07, 2013 3:06:23 PM. xmlTools.XMLTools writeXml
INFO: header.xml created successfully at C:\CWA2TestData_v0.3_3\headerCreator\in\header.xml
dec 07, 2013 3:06:23 PM. headerCreatorTool.LaunchHeaderCreator main
INFO: Header document processing completed in 528 milliseconds