Page 1 of 1

Extracting multiple occurences in XML file

Posted: Tue Mar 01, 2011 2:49 am
by cosec
I have an xml file with repeated info such as the following.

example:

<PRODUCT_INFO>
<PROD_CD>PROD_CD1</PROD_CD>
<PRODUCT_INFO>
<PRODUCT_INFO>
<PROD_CD>PROD_CD2</PROD_CD>
<PRODUCT_INFO>

I am required to store the first occurence (i.e. PROD_CD1) under a Field A and the second occurence (i.e. PROD_CD2) under a Field B.

I am able to extract the value for the first occurence. However unable to retrieve the second occurence. Please advice. Thanks.

Posted: Tue Mar 01, 2011 4:34 am
by ray.wurlod
Set up a stage variable to report whether you've already seen the opening PROD_CD tag - if you have, transfer the value to the second field; if you haven't, transfer the value to the first field.

Posted: Tue Mar 01, 2011 5:28 am
by Sreenivasulu
One question:
Any idea why the 'product_info' tag is not 'ending' ?

Posted: Tue Mar 01, 2011 3:26 pm
by ray.wurlod
Probably because cosec forgot to type the / characters!