XML File split

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

XML File split

Post 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
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post 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.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Give the DTD in XML Reader and pass the required output in an XML Writer or Seq file.
MaheshKumar Sugunaraj
Participant
Posts: 84
Joined: Thu Dec 04, 2003 9:55 pm

Post 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
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post 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]
Post Reply