Last modified on: 18 Feb 2019
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.
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.
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
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
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)
Here we have several use examples: We are going to use a Scheduler job called “sales_export” that extract data about a company customers.
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:
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> |
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:
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"?>
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> |
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:
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: