CSV to XML Converter


          Converts Comma-Separated-Value
csv
 csv
   csv        files to Xcelsius – SAP BO
           Dashboards 4.x compliant XML-
                          files
XML
 XML
  XML


                               Copyright – Gino Scheppers
CSVtoXML

   CSVtoXML (CSVtoXML.jar) is a „command-line driven‟
    Java-program, it converts one or more CSV-files to one
    or more Xcelsius & SAP BO Dashboards 4.x compliant
    XML-files.
   The program is platform independent. Runs in Windows,
    Sun Solaris, Unix, Linux,…
   CSVtoXML is freeware.
   Requisites:
       Java JRE 1.5 or higher
CSVtoXML
   Running the program with the –Help option, will result in an overview of
    all the available parameters.
   Cmd: java –jar <installdir>CSVtoXML.jar -Help
usage:
    CSVtoXML

   The program is a command-line driven java
    program, that can run from within a batch-file or
    script-file (like *.cmd, *. bat, …).
   Usage:
       java -jar <install dir>CSVtoXML.jar [Options]
       Example:
           java -jar “C:Program FilescsvtoxmlCSVtoXML.jar” -Help
   Important !
       All command-line-options are case-sensitive !
Option overview:
    CSVtoXML

   Option: -Help
       Shows all parameter options
   Usage:
       java -jar <install dir>CSVtoXML.jar -Help
       Example:
           java -jar “C:Program FilescsvtoxmlCSVtoXML.jar” -Help
Option overview:
    CSVtoXML

   Option: -cleanDirectory
       This option will clean the source-folder after the conversion process.
       Important: this option will clean the complete folder! In this case, the
        output-folder should be different from the source-folder, otherwise you
        will end-up with no files!
   Usage:
       java -jar <install dir>CSVtoXML.jar -cleanDirectory -sourceFolder
        c:/temp/csv -destinationFolder c:/temp/xml
       The above example will convert all files with extension *.txt and *.csv
        (=default behavior) in the source-folder to the destination-folder, after
        the conversion, all files in the source-folder will be deleted.
Option overview:
    CSVtoXML

   Option: -csvFilename <arg>
       Use this option to indicate the file to convert
       Important:
           Use slash instead of backslash in the path definition
                <arg> = <drive:/path/filename>
                <arg> = <//server/share/path/filename>

   Usage:
       java -jar <install dir>CSVtoXML.jar -csvFilename
        c:/temp/csv/kpi.csv
           The above example will convert the file kpi.csv to kpi.xml in the folder
            c:tempxml.
       java -jar <install dir>CSVtoXML.jar -csvFilename kpi.csv -
        sourceFolder c:/temp/csv/ -destionationFolder c:/temp/xml
           In the above example, the converted file will be placed in the folder c:tempxml
Option overview:
    CSVtoXML

   Option -sourceFolder <arg>
       Use this option to indicate the source path
       Important:
          Use slash instead of backslash in the path definition
               <arg> = <drive:/path/>
               <arg> = <//server/share/path/>
           Using this option without the -csvFilename option will convert all
            files in the source-folder
   Usage – example:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/
           The above example will convert all files (with extension *.csv and *.txt) in the
            folder c:tempcsv. The result will be placed in the same folder
Option overview:
    CSVtoXML

   Option: -destinationFolder <arg>
       Use this option to indicate the destination path
       Important:
          Use slash instead of backslash in the path definition
               <arg> = <drive:/path/>
               <arg> = <//server/share/path/>
           If you don‟t use this option, all converted files will be placed into
            the source-folder
           Tip: if the target-folder doesn‟t exist, it will be created by the
            program.
   Usage:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ -
        destinationFolder c:/temp/xml
           The above example will convert all files (with extension *.csv and *.txt) in the
            folder c:tempcsv. The result will be placed in c:tempxml
Option overview:
    CSVtoXML

   Option: -xmlFilename <arg>
       Default: the source-file name will be used as destination-file name,
        use this option if you want to rename the destination filename into
        another filename.
       Important:
           you can use the merge-option (see next slide) if you want to merge all files into
            one file.
   Usage:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ -
        destionationFolder c:/temp/xml -csvFilename kpi.csv -xmlFilename
        myXML.xml
           The above example will convert the file kpi.csv in the folder
            c:tempcsv into the xml-file myXML.xml in the directory
            c:tempxml
Option overview:
    CSVtoXML

   Option: -merge
       Use this option to merge all the converted files into one xml-file
       Important:
           Use this option in combination with the –xmlFilename option
   Usage – example:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ -
        destionationFolder c:/temp/xml -merge -xmlFilename myXML.xml
           The above example will convert all files (with extension *.csv and
            *.txt) in the folder c:tempcsv into one xml-file (myXML.xml)
            into the directory c:tempxml
           The source-filename without extension will be used as variable
            tag-name.
Option oveview:
    CSVtoXML

   Option: -variableNameRange <arg>
       Default, the name of the source-file (without extension) will be used as
        variable name tag, use this option if you want to change the <variable
        name>-tag into another name.
       Important:
           Don‟t use this option in combination with the –merge option
   Usage – example:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ -
        destionationFolder c:/temp/xml -csvFilename kpi.csv -
        variableNameRange kpi -xmlFilename myXML.xml
           The above example will convert the file kpi.csv in the folder
            c:tempcsv into one xml-file (myXML.xml) into the directory
            c:tempxml using kpi as variable-name tag.
Option overview:
    CSVtoXML

   Option: -zipFilename <arg>
       Use this option to indicate the name of the backup-file
       Important:
          Use slash instead of backslash in the path definition
               <arg> = <drive:/path/filename>
               <arg> = <//server/share/path/filename>
           If the target folder doesn‟t exist, it will be created.
           Using #date# or #datetime# in the name to replace it with the current date
            (format: yyyyMMdd ) or with the current timestamp (format:
            yyyyMMdd_HHmmss)
   Usage – example:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ -
        zipFilename c:/temp/zip/myZip#date#.zip
           The above example will convert all files (with extension *.csv and *.txt) in the
            folder c:tempzip, and zip into the file myZip20121101.zip
Option overview:
    CSVtoXML

   Option: -extensionFilter <arg>
       Default all files with extension *.csv and *.txt will be converted, use
        this option if you want to specify files with an other extension.
       Important:
           Use ; as delimiter if you want to specify more then one extension.
   Usage – example:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ -
        extensionFilter csv;txt;prn
           The above example will convert all files with extension *.csv, *.txt and *.prn in the
            folder c:tempcsv, into the same folder




                                       convert
Option overview:
    CSVtoXML
   Option: -delimiter <arg>
       Default ; is used as delimiter in the csv-file, use this option if you want
        to use an other delimiter.
   Usage – example:
       java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ -
        delimiter #
             The above example will convert all files with extension *.csv, *.txt in the folder
              c:tempcsv, into the same folder, using a crossroad (#) as delimiter.



        csv


                                                 xml
Example: converting two csv-files to one xml-file
   Suppose you want to monitor the number of BO accounts in a three pillar environment (dev,
    accept & production) on two different BO installations (Infra. One & Infra. Two)
   On a daily basis you receive two csv-files (InfraOne.csv and InfraTwo.csv) in the C:tmpcsv
    folder.
   Create a cmd-file with the following command to convert the two csv‟s to one xml-file.
        java -jar CSVtoXML.jar -sourceFolder "C:/tmp/csv/" -destinationFolder "C:/tmp/xml/" -
         merge -xmlFilename MergedXML.xml
        Create a dashboard using the XML-data connector
        read the next slides for more info
Example: converting two csv-files to one xml-file

        DWH


 Query & Export to csv




Convert with CSVtoXML.jar
Example: converting two csv-files to one xml-file
Example: converting two csv-files to one xml-file

Tip: define two Excel Named Ranges
with the same name of your variable
name – tag




                                      Important: The Import Named Ranges-
                                      button imports the Excel ranges, not the
                                      variable name-section in the xml-file!
Example: converting two csv-files to one xml-file
Refreshing your dashboard with new xml-data will result in a ‘Cannot Access External
Data’ error message. You will need to make a trusted version of your swf-file!
Steps
1. Right-click on the swf in the browser and click on Global Settings…
2. Click on the Advanced-tab and click on the Trusted Location Settings-
   button
3. Add the name of the swf-file as trusted file

4. Restart your dashboard in the browser
Logging Services

   Default „Log4j 1.2.16‟ from apache.org is used to
    log the program activity.
   Read http://logging.apache.org/log4j/1.2/ for more
    info.
   Tip: replace the original log4j.properties file in
    CSVtoXML.jar (use winzip to open the jar) with your own
    configuration file to customize the logging output.
   More info:
       http://www.tutorialspoint.com/log4j/log4j_configuration.htm
       http://logging.apache.org/log4j/1.2//apidocs/org/apache/log4j/EnhancedPatternLayout.html

CSV to XML Converter

  • 1.
    CSV to XMLConverter Converts Comma-Separated-Value csv csv csv files to Xcelsius – SAP BO Dashboards 4.x compliant XML- files XML XML XML Copyright – Gino Scheppers
  • 2.
    CSVtoXML  CSVtoXML (CSVtoXML.jar) is a „command-line driven‟ Java-program, it converts one or more CSV-files to one or more Xcelsius & SAP BO Dashboards 4.x compliant XML-files.  The program is platform independent. Runs in Windows, Sun Solaris, Unix, Linux,…  CSVtoXML is freeware.  Requisites:  Java JRE 1.5 or higher
  • 3.
    CSVtoXML  Running the program with the –Help option, will result in an overview of all the available parameters.  Cmd: java –jar <installdir>CSVtoXML.jar -Help
  • 4.
    usage: CSVtoXML  The program is a command-line driven java program, that can run from within a batch-file or script-file (like *.cmd, *. bat, …).  Usage:  java -jar <install dir>CSVtoXML.jar [Options]  Example:  java -jar “C:Program FilescsvtoxmlCSVtoXML.jar” -Help  Important !  All command-line-options are case-sensitive !
  • 5.
    Option overview: CSVtoXML  Option: -Help  Shows all parameter options  Usage:  java -jar <install dir>CSVtoXML.jar -Help  Example:  java -jar “C:Program FilescsvtoxmlCSVtoXML.jar” -Help
  • 6.
    Option overview: CSVtoXML  Option: -cleanDirectory  This option will clean the source-folder after the conversion process.  Important: this option will clean the complete folder! In this case, the output-folder should be different from the source-folder, otherwise you will end-up with no files!  Usage:  java -jar <install dir>CSVtoXML.jar -cleanDirectory -sourceFolder c:/temp/csv -destinationFolder c:/temp/xml  The above example will convert all files with extension *.txt and *.csv (=default behavior) in the source-folder to the destination-folder, after the conversion, all files in the source-folder will be deleted.
  • 7.
    Option overview: CSVtoXML  Option: -csvFilename <arg>  Use this option to indicate the file to convert  Important:  Use slash instead of backslash in the path definition  <arg> = <drive:/path/filename>  <arg> = <//server/share/path/filename>  Usage:  java -jar <install dir>CSVtoXML.jar -csvFilename c:/temp/csv/kpi.csv  The above example will convert the file kpi.csv to kpi.xml in the folder c:tempxml.  java -jar <install dir>CSVtoXML.jar -csvFilename kpi.csv - sourceFolder c:/temp/csv/ -destionationFolder c:/temp/xml  In the above example, the converted file will be placed in the folder c:tempxml
  • 8.
    Option overview: CSVtoXML  Option -sourceFolder <arg>  Use this option to indicate the source path  Important:  Use slash instead of backslash in the path definition  <arg> = <drive:/path/>  <arg> = <//server/share/path/>  Using this option without the -csvFilename option will convert all files in the source-folder  Usage – example:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/  The above example will convert all files (with extension *.csv and *.txt) in the folder c:tempcsv. The result will be placed in the same folder
  • 9.
    Option overview: CSVtoXML  Option: -destinationFolder <arg>  Use this option to indicate the destination path  Important:  Use slash instead of backslash in the path definition  <arg> = <drive:/path/>  <arg> = <//server/share/path/>  If you don‟t use this option, all converted files will be placed into the source-folder  Tip: if the target-folder doesn‟t exist, it will be created by the program.  Usage:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ - destinationFolder c:/temp/xml  The above example will convert all files (with extension *.csv and *.txt) in the folder c:tempcsv. The result will be placed in c:tempxml
  • 10.
    Option overview: CSVtoXML  Option: -xmlFilename <arg>  Default: the source-file name will be used as destination-file name, use this option if you want to rename the destination filename into another filename.  Important:  you can use the merge-option (see next slide) if you want to merge all files into one file.  Usage:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ - destionationFolder c:/temp/xml -csvFilename kpi.csv -xmlFilename myXML.xml  The above example will convert the file kpi.csv in the folder c:tempcsv into the xml-file myXML.xml in the directory c:tempxml
  • 11.
    Option overview: CSVtoXML  Option: -merge  Use this option to merge all the converted files into one xml-file  Important:  Use this option in combination with the –xmlFilename option  Usage – example:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ - destionationFolder c:/temp/xml -merge -xmlFilename myXML.xml  The above example will convert all files (with extension *.csv and *.txt) in the folder c:tempcsv into one xml-file (myXML.xml) into the directory c:tempxml  The source-filename without extension will be used as variable tag-name.
  • 12.
    Option oveview: CSVtoXML  Option: -variableNameRange <arg>  Default, the name of the source-file (without extension) will be used as variable name tag, use this option if you want to change the <variable name>-tag into another name.  Important:  Don‟t use this option in combination with the –merge option  Usage – example:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ - destionationFolder c:/temp/xml -csvFilename kpi.csv - variableNameRange kpi -xmlFilename myXML.xml  The above example will convert the file kpi.csv in the folder c:tempcsv into one xml-file (myXML.xml) into the directory c:tempxml using kpi as variable-name tag.
  • 13.
    Option overview: CSVtoXML  Option: -zipFilename <arg>  Use this option to indicate the name of the backup-file  Important:  Use slash instead of backslash in the path definition  <arg> = <drive:/path/filename>  <arg> = <//server/share/path/filename>  If the target folder doesn‟t exist, it will be created.  Using #date# or #datetime# in the name to replace it with the current date (format: yyyyMMdd ) or with the current timestamp (format: yyyyMMdd_HHmmss)  Usage – example:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ - zipFilename c:/temp/zip/myZip#date#.zip  The above example will convert all files (with extension *.csv and *.txt) in the folder c:tempzip, and zip into the file myZip20121101.zip
  • 14.
    Option overview: CSVtoXML  Option: -extensionFilter <arg>  Default all files with extension *.csv and *.txt will be converted, use this option if you want to specify files with an other extension.  Important:  Use ; as delimiter if you want to specify more then one extension.  Usage – example:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ - extensionFilter csv;txt;prn  The above example will convert all files with extension *.csv, *.txt and *.prn in the folder c:tempcsv, into the same folder convert
  • 15.
    Option overview: CSVtoXML  Option: -delimiter <arg>  Default ; is used as delimiter in the csv-file, use this option if you want to use an other delimiter.  Usage – example:  java -jar <install dir>CSVtoXML.jar -sourceFolder c:/temp/csv/ - delimiter #  The above example will convert all files with extension *.csv, *.txt in the folder c:tempcsv, into the same folder, using a crossroad (#) as delimiter. csv xml
  • 16.
    Example: converting twocsv-files to one xml-file  Suppose you want to monitor the number of BO accounts in a three pillar environment (dev, accept & production) on two different BO installations (Infra. One & Infra. Two)  On a daily basis you receive two csv-files (InfraOne.csv and InfraTwo.csv) in the C:tmpcsv folder.  Create a cmd-file with the following command to convert the two csv‟s to one xml-file.  java -jar CSVtoXML.jar -sourceFolder "C:/tmp/csv/" -destinationFolder "C:/tmp/xml/" - merge -xmlFilename MergedXML.xml  Create a dashboard using the XML-data connector  read the next slides for more info
  • 17.
    Example: converting twocsv-files to one xml-file DWH Query & Export to csv Convert with CSVtoXML.jar
  • 18.
    Example: converting twocsv-files to one xml-file
  • 19.
    Example: converting twocsv-files to one xml-file Tip: define two Excel Named Ranges with the same name of your variable name – tag Important: The Import Named Ranges- button imports the Excel ranges, not the variable name-section in the xml-file!
  • 20.
    Example: converting twocsv-files to one xml-file Refreshing your dashboard with new xml-data will result in a ‘Cannot Access External Data’ error message. You will need to make a trusted version of your swf-file! Steps 1. Right-click on the swf in the browser and click on Global Settings… 2. Click on the Advanced-tab and click on the Trusted Location Settings- button 3. Add the name of the swf-file as trusted file 4. Restart your dashboard in the browser
  • 21.
    Logging Services  Default „Log4j 1.2.16‟ from apache.org is used to log the program activity.  Read http://logging.apache.org/log4j/1.2/ for more info.  Tip: replace the original log4j.properties file in CSVtoXML.jar (use winzip to open the jar) with your own configuration file to customize the logging output.  More info:  http://www.tutorialspoint.com/log4j/log4j_configuration.htm  http://logging.apache.org/log4j/1.2//apidocs/org/apache/log4j/EnhancedPatternLayout.html