How to create XML file with repetitive elements using XML st

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Gopi Krishna
Participant
Posts: 10
Joined: Thu Jan 06, 2011 1:02 am
Location: Ramantapur,HYD

How to create XML file with repetitive elements using XML st

Post by Gopi Krishna »

I have a sequential which contains the data as below.

EmpName,phonenumber,email
xyz,12345,xyz@xyz.com
xyz,12345,abc@abc.com
xyz,56789,xyz@xyz.com
xyz,56789,abc@abc.com

I have to prepare an XML file with repetitive elements from this data as below.

<Emp>
<EmpName>XYZ</EmpName>
<Phonenumber>12345</phonenumber>
<phonenumber>56789</phonenumber>
<email>xyz@xyz.com</email>
<email>abc@abc.com</email>
</Emp>

I am using XML stage and the job design as below.

Seqfile ------ > XML stage ------ > Seq File

In XML stage I am using the Regroup to delare parent and child elements and XML Composer to generate the XML file. But getting the below error.

" XML_16,0: Fatal Error: OperatorTransitionFailedAtRuntime operator = 'UserRuntimeOperatorFrame:Op-RT-2[XML_Composer]', cause = 'java.lang.ClassCastException: java.lang.Long incompatible with java.lang.String"

Not sure about am i specifying the properties in right way or not. Can anybody tell me what this error means or If you have any sample job/Doc please share with me.

Thanks !
GK
MT
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 09, 2007 3:51 am

Post by MT »

Hi Gopi,

switch to mnimal validation in the validation tab of the composer.
Data type problems should be ignored then - it is a problem with data not corresponding to the XSD I suppose.
regards

Michael
Gopi Krishna
Participant
Posts: 10
Joined: Thu Jan 06, 2011 1:02 am
Location: Ramantapur,HYD

Post by Gopi Krishna »

Hi Michael

Thanks for the response. Right now i am running the job with minimal validation only even though facing the issue.
GK
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

We'll assume for the moment that the emails and the phone numbers are not related?

Meaning...they are two separate lists within the xsd? both "maxOccurs=unbounded"?

...or are they related to each other (email #1 goes with phone #1, etc.). ?

Could there be 2 phone numbers and (for example), 15 emails?.

Whether they are related to each other in the xsd will have implications on the design of your assembly.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply