Generic XML Exporter - User Manual

What is the Generic XML Exporter?

The Generic XML exporter is a custom exporter designed to allow to Scheduler Server to export data from different sources into an XML file.

As an additional feature, it also offers the possibility of use an XSLT template to transform the extracted data into a different type of file, not only XML files.

How to install the XML exporter

In order to install the XML exporter you have to download it from the Denodo Support Site. Once uncompressed, connect to the Scheduler Server via the Scheduler WebAdmin Tool and log in.

Once connected, click on “Configuration -> Plugins” in order to access the “Plugins Configuration” section.

Click on the “New Plugin” button in order to access the “new plugin” input form.

Select the XML Exporter’s jar with dependencies file, which will be called something similar to denodo-xml-exporter-6.0-20170321-jar-with-dependencies.jar (version

numbers might change), and click on the “Accept” button, and after the success page, you will see your new exporter in the “Plugins” section.

Using the XML exporter

In this section we are going to modify a Scheduler Job that extracts data from our customer database and exports it using our XML exporter using different combination of its parameters.

The exporter offers some configuration parameters:

Mandatory

  • output_folder (String): It specifies the folder where the output files will be generated.

  • output_file_name (String): Name of the generated file. It offers support for placeholders that will be filled with execution parameters. The supported parameters are:

  • @{projectName}: name of the project

  • @{jobName}: name of the particular job

  • @{jobID}: id of the particular job

  • @{jobTime}: time of execution of the job, in format yyyyMMdd-HHmmss

NOTE: adding @{jobTime} to the output file name is normally a good idea to avoid file name collision, which might result in previous output files being deleted. For example, an useful output name could be: @{projectName}_@{jobName}_@{jobTime}.xml

Optional

  • results_per_file (Integer): specifies the maximum number of rows coming from the job query that will be included in one single file. If the job return more than this number

            of rows new files will be created with the results appending a sequence

number to the file name (before the extension).  Default: "0" (only one .xml file will be generated)

  • root_node (String) : Key for the root tag. Default: "root"

  • row_node (String) : Key for the row tag. Default: "row"

  • xslt_file (String) : Path to the XSLT file with the transformation to be applied. If blank, no transformation will be applied. Default: empty (no transformation)

  • keep_original_XML (Boolean): If true (and an XSLT transformation is applied) the original XML file will be also generated (with .original at the end of the file name).  Default: "false"

Here we have several use examples: We are going to use a Scheduler job called “sales_export” that extract data about a company customers.

Case 1: Create a default XML

Click on the “sales_export” link, and edit it to add a new excel exporter.

Click on “Edit Job -> Exporters Section -> New Exporter

Fill the mandatory fields:

  • output_folder: C:\Temp

  • output_file_name: output_file.xml

Execute the job, and the ouput_file.xml will be created into the selected folder. This is the content of the result file.

<?xml version="1.0" encoding="UTF-8"?>

<root>

   <row>

          <id>B78596112</id>

          <summary>POTS line Incidence</summary>

          <income>5123</income>

   </row>

   <row>

          <id>B78596112</id>

          <summary>Additional line installation</summary>

          <income>5123</income>

   </row>

   <row>

          <id>B78596113</id>

          <summary>Incidence on ADSL router</summary>

          <income>975</income>

   </row>

   <row>

          <id>B78596022</id>

          <summary>Switchboard configuration</summary>

          <income>5151</income>

   </row>

   <row>

          <id>B78596022</id>

          <summary>ADSL router failure</summary>

          <income>5151</income>

   </row>

   <row>

          <id>B78596023</id>

          <summary>Switchboard configuration</summary>

          <income>5512</income>

   </row>

   <row>

          <id>B78596023</id>

          <summary>Additional line installation</summary>

          <income>5512</income>

   </row>

</root>

Case 2: Results per file limit

Edit the exporter and type 3 in results per file field. Run the job.

Three files will be created: outputfile.xml, outputfile_1.xml, outputfile_2.xml

outputfile.xml and outputfile_1.xml will have 3 results. outputfile_2.xml will have 2 results.

This is the final content of data folder:

Case 3: Change encoding

Edit the job and set latin encoding filling xml_encoding field with value  "ISO-8859-1".

Once the job is completed you will notice that the encoding of xml files has changed to

<?xml version="1.0" encoding="ISO-8859-1"?>

Case 4: change root_node and row_node

Change root_node to “customers” and row_node to “customer”.

If you execute the job, you will get as a result a file with these names as nodes.

Here is an example:

<?xml version="1.0" encoding="ISO-8859-1"?>

<customers>

   <customers>

          <id>B78596112</id>

          <summary>POTS line Incidence</summary>

          <income>5123</income>

   </customers>

   <customers>

          <id>B78596112</id>

          <summary>Additional line installation</summary>

          <income>5123</income>

   </customers>

   ...

   ...

   <customers>

          <id>B78596113</id>

          <summary>Incidence on ADSL router</summary>

          <income>975</income>

   </customers>

</customers>

Case 5 Transform the results using a xslt file  

One of the most interesting features of this exporter is the possibility of transform extracted data using a xslt template.

Change output_file_name field to “outputfile.html” and set in xslt_file the following template:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:template match="/">

      <html>

         <body>

      <h2>customers</h2>

        <table border="1">

             <tr bgcolor="#9acd32">                    

      <th>id</th>

      <th>summary</th>

      <th>income</th>        

             </tr>

             <xsl:for-each select="customers/customer">

   <tr>      

                  <td><xsl:value-of select="id"/></td>

<td><xsl:value-of select="summary"/></td>

<td><xsl:value-of select="income"/></td>              

   </tr>

          </xsl:for-each>

        </table>

         </body>

      </html>

   </xsl:template>

</xsl:stylesheet>

Executing the job you will get a final file called “outputfile.html” like this:

Case 6: Keep original XML file

In spite of using a XSLT template to transform the extracted data, you could be interested in to keep the original XML file. Click on keep_original_XML to create the XMLs files and the transformed file.

This is the final result: