Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Looping through XML files

  1. #1
    Join Date
    Aug 2008
    Posts
    16

    Default Looping through XML files

    Hi,

    We have an XML input file containing multiple entries of a parent tag inside a root tag. What we want to do is process(insertig into DB) one parent tag, then read and process another XML input file which we get by passing the id of this parent tag and continue doing so with the remaining parent tags.

    e.g. Parent XML file is as follows:

    <community>
    <block nil="true"/>
    <created-at type="datetime">2008-08-08T20:09:56Z</created-at>
    <description nil="true"/>
    <id type="integer">1</id>
    <is-private type="boolean" nil="true"/>
    <name>Root</name>
    <organization-id type="integer">3</organization-id>
    <parent-id type="integer" nil="true"/>
    <permalink>root</permalink>
    <state>active</state>
    <updated-at type="datetime">2008-08-08T20:09:56Z</updated-at>
    </community>
    <community>
    <block nil="true"/>
    <created-at type="datetime">2008-08-08T20:09:56Z</created-at>
    <description nil="true"/>
    <id type="integer">2</id>
    <is-private type="boolean" nil="true"/>
    <name>Root</name>
    <organization-id type="integer">3</organization-id>
    <parent-id type="integer" nil="true"/>
    <permalink>root</permalink>
    <state>active</state>
    <updated-at type="datetime">2008-08-08T20:09:56Z</updated-at>
    </community>

    After processing one community tag above, we need to read another XML file say Child.xml which is as follows:

    <communities type="array">
    <community>
    <depth type="integer" nil="true"/>
    <id type="integer">1</id>
    <name>Home</name>
    <organization-id type="integer">1</organization-id>
    <permalink>home</permalink>
    </community>
    <community>
    <depth type="integer" nil="true"/>
    <id type="integer">7</id>
    <name>New community</name>
    <organization-id type="integer">1</organization-id>
    <permalink>new-community</permalink>
    </community>
    </communities>

    Please let us know how can we read the child XML file before moving ahead with reading the second parent tag and come back to read the next prent tag and continue doing so.

  2. #2
    DEinspanjer Guest

    Default

    I don't think it would be very easy to actually block the reading of the parent records. You can process them one at a time by passing them through a job that loops on each row, but the XML input step you use is going to read the whole file as fast as it can.

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.