Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: XML input step - how to obtain a partial xml input?

  1. #1
    Join Date
    Feb 2011
    Posts
    27

    Question XML input step - how to obtain a partial xml input?

    I am trying to use the XML input step to partially parse out the XML file:
    Example file:
    -----------------
    <main>
    <account number="1">
    <salutation>Mr.</salutation>
    <action_1>
    <activity>1</activity>
    <activity>2</activity>
    <activity>3</activity>
    </action_1>
    <action_2>
    <topic>so long</topic>
    <activity>sad</activity>
    </action_2>
    </account>
    <account number="2">
    <salutation>Mrs.</salutation>
    <action_1>
    <activity>332</activity>
    <activity>22</activity>
    <activity>333</activity>
    </action_1>
    <action_2>
    <topic>welcome</topic>
    <activity>happy</activity>
    </action_2>
    </account>
    </main>

    --------------------------------
    What I'm trying to accomplish is that I read and parse into fields account number and salutation, but everything deeper (actions, activities etc) I want to pass "AS IS" as a string field to be written to a dbase column.
    So the table layout is:
    ACCOUNT | SALUTATION | XML_STUFF

    The problem I have is that the XML input step - when it hits the level of "XML_STUFF" strips out all the XML tags and only passes the values as text and empty spaces in-between.
    In another instance I was able to bypass this issue by formatting the source XML with CDATA wrapper, but in this instance - the XML comes to me in certain format that I have no control over.

    How can I accomplish my goal with kettle?? Can I ??

    HELP please !
    Thanks

  2. #2
    Join Date
    Nov 2008
    Posts
    777

    Default

    Sure you can do it in kettle. For the "everything deeper" xml_stuff field, select a "Result type" of "Single node" instead of "Value of". That should preserve all the tags.
    pdi-ce-4.4.0-stable
    Java 1.7 (64 bit)
    MySQL 5.6 (64 bit)
    Windows 7 (64 bit)

  3. #3
    Join Date
    Feb 2011
    Posts
    27

    Default

    Wow - didn't even consider that! Works like a charm ! Thanks!!!!

Tags for this Thread

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.