Page 1 of 1

XML File split

Posted: Wed Apr 13, 2005 1:53 pm
by shrey3a
Hi ,

I have a XML output file in one string as below

"<student><Firstname>mike</firstname><lastname>brown</lastname></student><student><Firstname>rob</firstname><lastname>donty</lastname></student>"

I need to split the above file on basis of parent tag i.e. <Student> and have the o/p in below format i.e. for each record one row.

Row1<student><Firstname>mike</firstname><lastname>brown</lastname></student>

Row2<student><Firstname>rob</firstname><lastname>donty</lastname></student>


Thanks in Advance for help

Regards,
Munish

Posted: Wed Apr 13, 2005 6:01 pm
by vmcburney
You might have trouble reading this in DataStage if it is a large file. You are on Unix so the easiest way would be a Unix awk command that adds and end of line character to the end of the </STUDENT> string. Can't tell you the exact command, don't know awk that well.

Posted: Thu Apr 14, 2005 4:15 am
by Sainath.Srinivasan
Give the DTD in XML Reader and pass the required output in an XML Writer or Seq file.

Posted: Thu Apr 14, 2005 10:45 am
by MaheshKumar Sugunaraj
I guess you must have the XML Input/output stage installed on your system, Once you have the file Use the XML Metadata Importer and Import the Table Definition for the file and then you could use the XML Output stage to retive the values by passing the appropriate parameters.

Hope this helps.

Thanks & Regards
Mahesh

Posted: Thu Apr 14, 2005 3:17 pm
by shrey3a
Thanks to all , it solved the problem by pasing the dta thro' the XML writer.

Regards

[quote="MaheshKumar Sugunaraj"]I guess you must have the XML Input/output stage installed on your system, Once you have the file Use the XML Metadata Importer and Import the Table Definition for the file and then you could use the XML Output stage to retive the values by passing the appropriate parameters.

Hope this helps.

Thanks & Regards
Mahesh[/quote]