Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Get Data From XML questions

  1. #1
    Join Date
    Oct 2008
    Posts
    7

    Default Get Data From XML questions

    Dear experts:

    I have read some of the kettle documents, and trying to parse some xml using "Get Data From XML". After reading your online documents, wiki etc, I still have some questions which I have not figured out:

    Q1. If there are multiple same level (xpath) tags, and I want only the last one, how could we ignore the first one if and only if the last one exists?

    Example:

    </ddd:update>
    <ddd:name>ignore me</ddd:name>
    <ddd:rem>
    <ddd:ns>ignore me, please</ddd:ns>
    </ddd:rem>
    </ddd:update>

    </ddd:update>
    <ddd:name>This is my name</ddd:name>
    <ddd:add>
    <ddd:ns>add me , please</ddd:ns>
    </ddd:add>
    </ddd:update>

    Q2: Repeat through same attributes but different values. We do NOT know how many will be repeated in advances:

    <tag:s>
    <ddd:status s="S1" lang="en">Status 2</ddd:status>
    <ddd:status s="S2" lang="en">Status 4</ddd:status>
    <ddd:status s="S3" lang="en">Status 6</ddd:status>
    <!-- could be more like above -->
    </tag:s>

    If I do not know how many of the above will repeat, how to loop through and get all the existing attributes and values?

    Thank you very much,

    Frank

  2. #2
    Join Date
    Oct 2008
    Posts
    7

    Default

    Oh, the first xml sample should read:

    <ddd:update>
    <ddd:name>ignore me</ddd:name>
    <ddd:rem>
    <ddd:ns>ignore me, please</ddd:ns>
    </ddd:rem>
    </ddd:update>

    <ddd:update>
    <ddd:name>This is my name</ddd:name>
    <ddd:add>
    <ddd:ns>add me , please</ddd:ns>
    </ddd:add>
    </ddd:update>

    Thanks,
    Frank

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.