Page 1 of 1

Xml file to Flat file

Posted: Fri May 27, 2011 3:34 am
by bkar
I need to transform a XML file data into a flat file. 1st step I did is craeted XML table definition using XML metadata importer.

Then I have taken a XML input stage and sequential file stage and loaded columns from table definition to XML input.

what input I should give to XML input? I'm doing it on parallel job.

worth mentioning I'm new to Datastage and need a detailed steps.

Thanks

Re: Xml file to Flat file

Posted: Fri May 27, 2011 4:15 am
by bicap
Seq-file ===> XML input stage ===> Seq-file

1) Seq file stage- reading each xml input record in a single colunm. pass this to next stage.

2) XML input stage --

Stage tab :
Transformations output : check Repetation element required and Replace NULL with emty values.
Input tab :
XML Source : provide input column name which contains xml record.
Coulnm Content : Check XML document

Output tab :
Transformations output : check Inherit stage properties.
Columns : Import metadata created from XSD or XML data file using XML metadata parser.

3) Seq -file - Your output. Check output you find the values as NULL for those columns whose respective tagnames were missing in input xml file.

Posted: Fri May 27, 2011 7:01 am
by chulett
Don't use a Sequential File stage to read XML, too many possible issues there. Follow Ernie's advice here instead.

Posted: Fri May 27, 2011 10:18 am
by FranklinE
chulett wrote:Follow Ernie's advice instead.
I did exactly that, and I had no difficulty getting it to work.

Posted: Sat May 28, 2011 6:29 am
by Ravi.K
Refer the below thread which gives good idea.

viewtopic.php?t=138188&highlight=XML