Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Two questions with XML Output

  1. #1

    Default Two questions with XML Output

    Hi,
    Any help on these would be very welcome!

    I am taking data from Excel:

    CODE TITLE GENDER
    1323 Mr MALE
    1325 Ms FEMALE
    etc.

    And output something like:

    <titleList>
    <title code="1323" gender="MALE">Mr</title>
    <title code="1325" gender="FEMALE">Ms</title>
    </titleList>

    I can almost get there with "Add XML", except that I have not figured out how to get it to output:
    <title ...>VALUE</title>

    It always wants to do something like:
    <title ...><title>VALUE</title></title>

    QUESTION 1: How do I take the text value from a non-attribute field and apply to an element: <elem [ATTRIBS]>VALUE</elem>?

    Trying to solve the above, I tried using an "XML Output":

    I got:
    <titleList>
    <title><title>Mr</title><gender>MALE</gender><code>1323</code></title>
    ...etc...
    </titleList>

    Which is further away from what I want.

    QUESTION 2: How can set fields to be attributes for an XML Output? I tried prefixing the field name with @ but it took it as a lieral.

    I know there are two questions, but it is really one problem with two different attempts to solve.

    BTW Kettle is REALLY impressive, I've done some pretty complex integrations in some cases only two steps.
    Thanks in advance,
    Peter
    Last edited by pdavie; 07-19-2007 at 06:04 AM. Reason: Correcting minor error in question 2

  2. #2
    Join Date
    Oct 2006
    Posts
    20

    Default

    look at the example in

    \samples\transformations\XML Add - creating multi level XML files.ktr

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.