Extract field from XML

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
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Extract field from XML

Post by sunil_acc »

HI all,
Is it possible to extract just 1 record from an XML as i need to check the condition on that record and then make further transformation.

I am able to take XML as input and able distribute them on the basis of there file name but i need to check a data (a field value in heirarchical structure) from XML and have to distribute XML's to different folders according to that data.

Thanks
Sunil
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Post by sunil_acc »

Add to above i have a structure like

FOLDER -----> XML Input -----> Transformer (processing not Xml one)---->Seqential file


Now Folder to Xml is working fine but Input stage is not converting it to sequential output and throwing an error:
"Text can only occur as a direct child of a "column" element. "

What to do in this case.

Thanks
Sunil
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Found the solution

Post by sunil_acc »

Hi all,
Well i am done withj above problem.

Thanks
Sunil
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The fact that no-one replied suggests that this is a difficult problem to which no-one could contribute anything.

If you have solved it, please post the solution, so that others can be more productive.

If you have abandoned it, please post that fact also.

This is a place where we share.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sunil_acc
Participant
Posts: 28
Joined: Thu Oct 20, 2005 5:49 am

Post by sunil_acc »

Hi to all,

Ya this is a place to share!!!!!! As i got the solution from here itself while reading some other articles. Thanks to all...

Well the job which i was trying to create goes as with foll things:

1. For XML INPUT : Input : Stream data (XML doc)
Output: Sequential data.
2. For Xml Output: Input : Seq data
Output : XML doc
3. XML Transformer : Input : Stream data (XML doc)
Output : XML doc.
4. Folder stage: Input : Folder from which XML file is to be taken
Output: a) FILENAME
b) Record (containing whole XML file)

Now i used:

Folder Stage ---> XML Input ---> Transformer (normal one not XML one) --->Xml output.

so folder stage provides file name and record. The XML input took those two fields and in XML SOURCE property either use filename (check url) or record (check xml doc field).
In output of XML input create columnd as per here XPATH.
Than in transformer (this is a general PROCESSING transformer) make selection crirterias.
In xml output use the data from transformer as input and trace with proper XPATH and use SAE FILE AS option to a path where the output xml file needs to be created..


Well thats all i did.
If somebody wants more help or want to share more do write......

And thanks for making me rember that we all need to share our little knowledge to make a knowledge database.

Thanks
Sunil..........
Post Reply