Page 1 of 1

Parse Repeating XML Tags

Posted: Tue Jul 15, 2008 9:51 am
by naveend
I am getting input XML in the format below. I need to pull the value in the tag <name> and create 1 row with 7 columns (populated by the different values in the <name> tag). Since the tag name <EObjCdProdTp> is the same for all the blocks, I am getting 7 rows and 1 column. Is there a way to do this?


<ResponseObject>
<EObjCdProdTp>
<description>SEM</description>
<lang_tp_cd>100</lang_tp_cd>
<lang_type>English</lang_type>
<last_update_dt>2008-05-20 12:00:00.0</last_update_dt>
<name>616</name>
<tp_cd>6000673</tp_cd>
</EObjCdProdTp>
<EObjCdProdTp>
<description>COMPACT</description>
<lang_tp_cd>100</lang_tp_cd>
<lang_type>English</lang_type>
<last_update_dt>2008-05-20 12:00:00.0</last_update_dt>
<name>MMCWL</name>
<tp_cd>5001035</tp_cd>
</EObjCdProdTp>
<EObjCdProdTp>
<description>Compact Wheel</description>
<lang_tp_cd>100</lang_tp_cd>
<lang_type>English</lang_type>
<last_update_dt>2008-05-20 12:00:00.0</last_update_dt>
<name>CWL</name>
<tp_cd>4001020</tp_cd>
</EObjCdProdTp>
<EObjCdProdTp>
<description>Compact Equip</description>
<lang_tp_cd>100</lang_tp_cd>
<lang_type>English</lang_type>
<last_update_dt>2008-05-20 12:00:00.0</last_update_dt>
<name>CCE</name>
<tp_cd>3001003</tp_cd>
</EObjCdProdTp>

</ResponseObject>

Posted: Wed Jul 16, 2008 12:48 am
by eostic
It is what it is, seven "instances" of a thing called EObj... You need a technique to "reverse pivot" your seven rows. I'm sure there are many such techniques described in the forum here (it can be done in a variety of ways that use everything from stage variables to Aggregations), along with one or two entries that describe using XSLT, if you want to go that route.

Ernie

Posted: Sat Jan 09, 2010 12:29 pm
by shukla_krishna
eostic wrote:It is what it is, seven "instances" of a thing called EObj... You need a technique to "reverse pivot" your seven rows. I'm sure there are many such techniques described in the forum here (it can be done in a variety of ways that use everything from stage variables to Aggregations), along with one or two entries that describe using XSLT, if you want to go that route.

Ernie
Parse the fisrt object and take the resultant in a column , and aply xml inut stage , with ur defined table structure . u will get 7 rows based on ur table structure