Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: XML input: No field "Position code" for text node?

  1. #1
    Join Date
    Sep 2005
    Posts
    1,403

    Default XML input: No field "Position code" for text node?

    Hi,


    this is my first post here, and I'd like to use this opportunity to express my thanks for this wonderful product! Together with pentaho I'm sure this will make some waves in the BI market.



    Now, my question. I'm playing around with spoon (Kettle - spoon 2.3.0) and I want to import XML into a database table. Now, my XML is like this:



    <result>
    <actors>
    <actor id="00000015">Anderson, Jeff</actor>
    <actor id="00000030">Bishop, Kevin</actor>
    <actor id="0000000f">Bonet, Lisa</actor>
    </actors>
    </result>



    (you can look it up at: http://www.stylusstudio.com/examples/videos.xml)
    Now, In the "Content" tab of the XML input properties I specify result, and then actors and then actor as the repeating part (actor is the equivalent of a record).



    What I would like todo is grab the text inside the actor elements and transform that (split into first- and lastname) so I can put it in my database table (which has a firstname and lastname column).



    The problem is that I do not know what code to type into the "position" column in the "fields" tab; I would like to type something like



    T=text()



    or maybe just



    T



    or



    text()



    to indicate that I need the text rather than some child element.






    How should I go about this?






    Thanks in advance,



    Roland Bouman



    Information analyst
    BI consultant

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: XML input: No field "Position code" for text node?

    Hi Roland,

    You can just use the "Split Fields" step I guess.
    Specify the field to split, delimiter (,) and:

    Lastname, String, 50
    Firstname, String, 50

    Leave the rest blank. That&#39;s used for situations like:

    "Firstname=Bonet, Lastname=Bonet"

    HTH,
    Matt

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: XML input: No field "Position code" for text node?

    Sorry Man, just tried it, and I see what you mean.
    Let me think about this one.

    Matt

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: XML input: No field "Position code" for text node?

    Just commited a patch to 2.3.0 to allow you to grab the root of the repeating element with R=actor/1


    "Get fields" in the XML Input dialog will add this one as well if it's used somewhere.



    Grab a new kettle.jar to try it out.



    HTH,



    Matt

  5. #5
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: XML input: No field "Position code" for text node?

    Hi Matt,





    Gosh you guys are QUICK! Awesome, trying it right away...

  6. #6
    Join Date
    Sep 2005
    Posts
    1,403

    Default Yep, text node from XML import works, but I found a reproducible crash you might like to know about.

    Hey that works terific!


    Thanks a bunch.



    I noticed one little bugsie though. It's totally unrelated to this issue, but I figured you might be interested. Ok, it's like this:
    1) click an XML input step
    2) right click to bring up the context menu
    3) duplicate step



    --> let's say a really quick way to exit spoon






    (Actually, I mean it crashes without any notice or warning)



    I do not observe this behaviour with other steps (at least I tried it with Sort rows, Unique Rows, Database lookup, Insert/Update, Split fields and Select values) so it seems to have to do with XML input.



    When I copy to clipboard and paste, it works as expected though.

  7. #7
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Yep, text node from XML import works, but I found a reproducible crash you might like to know about.

    Duplicate clones the data structure, copy/paste passes through XML.
    I guess undo/redo bombs as well then.


    Watch tracker 2362 for this bug.



    Thanks for the feedback!



    Matt

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.