Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Pentaho CSV file to XML file transformation

  1. #1
    Join Date
    Sep 2013
    Posts
    1

    Post Pentaho CSV file to XML file transformation

    Am new user to pentaho, am having difficulty while transformaing csv file to xml file using pentaho.


    This is the end result I'm trying to get:

    <elements>
    <elementDate id="Element Name1">2018-02-27</elementDate>
    <elementDate id="Element Name1">2018-02-28</elementDate>
    <elementString id="Element Number1">USER_1</elementString>
    <elementString id="Element Number2">USER_2</elementString>
    <elementNumber id="Element Date1">0.0</elementNumber>
    <elementNumber id="Element Date2">0.1</elementNumber>
    </elements>

    But am not getting the above result because of same node name for different elements,

    if run my kettle transformation i wll get reult like,

    <elements>
    <elementDate id="Element Date2">2018-02-27</elementDate>

    <elementDate>2018-02-28</elementDate>

    <elementString id="Element Name2">USER_1</elementString>

    <elementString>USER_2</elementString>

    <elementNumber id="Element Number2">0.0</elementNumber>

    <elementNumber>0.1</elementNumber>

    </elements>

    My CSV file is like,

    ELEMENT_DATE1,ELEMENT_DATE2,ELEMENT_STRING1,ELEMENT_STRING2,ELEMENT_NUMBER1,ELEMENT_NUMBER2
    2018-02-27,2018-02-28,USER_1,USER_2,0.0,0.1




    i have attached my samples here,

    How do i do this can anyone help me,

    Thanks,
    Jhansi
    Attached Files Attached Files
    Last edited by jhansirani; 12-24-2013 at 02:39 AM.

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

    Default

    The input to your Add XML column step (ElementFields) must look like this:

    name id value
    elementDate Element Date1 2018-02-27
    elementDate Element Date2 2018-02-28
    elementName Element Name1 USER_1
    elementName Element Name2 USER_2
    elementNumber Element Number1 0.0
    elementNumber Element Number2 0.1

    So your first task would be to design a transformation producing the necessary data format.
    You will hurt yourself a lot with your data design, though - both, CSV and XML.
    So long, and thanks for all the fish.

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.