The Altair Community is migrating to a new platform to provide a better experience for you. The RapidMiner Community will merge with the Altair Community at the same time. In preparation for the migration, both communities are on read-only mode from July 15th - July 24th, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here.
Options

Read XML data with multiple child nodes and transform into examples

etmpoon999etmpoon999 Member Posts: 2 Contributor I
I have records in XML like the one below. Each record has one parent <Id></id> and unlimited number of child events. Each event has it's own <EventId></EventId>. All <Id> and <EventId> are unique.

<list>
  <Request>
    <hd_att1>false</hd_att1>
    <hd_att2>true</hd_att2>
    <detail>
      <info1>false</info1>
      <info2>false</info2>
      <Id>14901</Id>
      <Events>
        <Event>
          <name>false</name>
          <EventId>14253</EventId>
          <eventloc>
            <Name>abc</Name>
          </eventloc>
          <target>
            <Name>xyz</Name>
          </target>
        </Event>
        <Event>
          <name>false</name>
          <EventId>25873</EventId>
          <eventloc>
            <Name>abc</Name>
          </eventloc>
          <target>
            <Name>xyz</Name>
          </target>
        </Event>
      </Events>
    </detail>
  </Request>
</list>

I am managed to use Generate Extract to read the XML data by manually adding 20 child XPathes. The resulting example is one row with a parent and 20 children like the one below.

<Id>, <hd_att1>, <hd_att2>, <info1>, <info2>, <event.name1>, <event.EventId1>, <event.eventloc.name1>, <event.target.name1>, <event.name2>, <event.EventId2>, <event.eventloc.name2>, <event.target.name2>, .....

I actually need examples of parents with each of its own child like the below.

<Id>, <hd_att1>, <hd_att2>, <info1>, <info2>, <event.name>, <event.EventId>, <event.eventloc.name>, <event.target.name>
<Id>, <hd_att1>, <hd_att2>, <info1>, <info2>, <event.name>, <event.EventId>, <event.eventloc.name>, <event.target.name>

I can't find how to transform the row into multiple rows by attributes. Please help.

And, may be you have better idea to extract the child nodes instead of manually adding child XPathes.




























Sign In or Register to comment.