Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Generating multi-level XML with Kettle 4.4

  1. #1
    Join Date
    Dec 2012
    Posts
    10

    Default Generating multi-level XML with Kettle 4.4

    I have looked at the examples and they don't quite do what i need to do, so thought I'd ask. It seems the easiest way to do this is with XSLT or else to build a plugin that would allow us to use a templating engine like velocity or freemarker.

    Thanks

    I need to generate from a single row of input, xml like

    <Thingy>
    <Id>col1</Id>
    <Constant Elements/>
    <Data>
    <DataType>
    <Name>col2</Name>
    </DataType>
    </Data>
    <MoreStuff>col3</MoreStuff>
    <Notes/>
    <Other Constant Elements/>
    <Tags>
    <Tag>
    <Name>meta4</Name>
    <Value>col4</Value>
    </Tag>
    <Tag>
    <Name>meta5</Name>
    <Value>col5</Value>
    </Tag>
    </Tags>
    </Thingy>

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Looks feasible to me
    Attached Files Attached Files
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Dec 2012
    Posts
    10

    Default

    Nice, but it seems to only work for 1 row from the input. Not sure what we need to process 30 rows the same way.

  4. #4
    Join Date
    Feb 2011
    Posts
    840

    Default

    you could also use this XSL to make it more user-friendly

    Code:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">    <xsl:output omit-xml-declaration="yes" indent="yes"/>
        <xsl:strip-space elements="*"/>
        <xsl:template match="node()|@*">
            <xsl:copy>
                <xsl:apply-templates select="node()|@*"/>
            </xsl:copy>
        </xsl:template>
    </xsl:stylesheet>
    and... the basics really are covered with marabu's sample... but if you want something worst, I can try to remove sensitive data from an old transformation I have...


    I've mentioned this one last week on this other thread...

    It's result is an XML file kinda like this one:
    Code:
    <documentoDLO cnpj="00000000" codigoConglomerado="X0000000" dataBase="yyyy-MM">
       <limitesInformados>
          <limite codigoLimite="00.00" enviado="X"/>
          <limite codigoLimite="00.00" enviado="X"/>
       </limitesInformados>
       <parametros>
          <parametro codigoParametro="0" valorParametro="00"/>
       </parametros>
       <contas>
          <conta codigoConta="000.00" valorConta="0.00"/>
          <conta codigoConta="000.00" valorConta="0.00">
             <detalhamento valorDetalhe="0.00">
                <detalhe codigoElemento="0" valorElemento="00"/>
                <detalhe codigoElemento="0" valorElemento="0.00"/>
             </detalhamento>
          </conta>
       </contas>
    </documentoDLO>
    I just forgot to ask, before editing... it was you who asked for a 1 row input. If you have more input, it'll depend on which level that input will go into, how it'll be joined and some info like that...
    Last edited by joao.ciocca; 03-05-2013 at 03:43 PM.
    Join us on IRC! =)

    Twitter / Google+ / Timezone: BRT-BRST
    BI Server & PDI 5.4 / MS SQL 2012 / Learning CDE & CTools
    Windows 8 64-bit / Java 7 (jdk1.8.0_75)

    Quote Originally Posted by gutlez
    PLEASE NOTE: No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.

    I'm no expert.Take my comments at your own risk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.