Page 1 of 1

How to read whole XML file as a string and in DataStage.

Posted: Tue Apr 22, 2014 3:02 pm
by vgundavarapu
Hi All,

I have XML file, so I need to read whole XML file as a string and map to one output column in DataStage. I have tried no. ways, but no luck. Please help on this.


Thanks,
Venkata

Posted: Tue Apr 22, 2014 3:17 pm
by qt_ky
Have you tried using the XML stage?

Here is an article link.

http://www.ibm.com/developerworks/data/ ... index.html

How to read whole XML file as a string and in DataStage.

Posted: Tue Apr 22, 2014 3:31 pm
by vgundavarapu
Thank you for your quick reply.

I am using XML stage currently.

I have read that online document, but they didn't mentioned exactly how to read whole XML file and map to one column.

They only talked about retrieving two flat files and composed as XML file and load into DB2 table.

In my case, I have XML file as source and need to load whole XML file into DB2 Column as XML type or STRING.


Thanks,
Venkata

Posted: Tue Apr 22, 2014 3:44 pm
by chulett
There's no need for two conversations on the same topic. This one wins.

How to read whole XML file as a string and in DataStage.

Posted: Tue Apr 22, 2014 5:15 pm
by vgundavarapu
Hi Craig,

It's OK for me.

I have read online documents since morning as you mentioned, but I didn't find the correct solution so far.

I need to one thing is how to read whole XML file as String.


Thanks,
Venkata

Posted: Tue Apr 22, 2014 6:38 pm
by eostic
If you are just reading it all as one big string, and it's in a disk file, then use a Server Job, with a Folder Stage...that will pick up "the whole file" within a single column......push it wherever you want to. No sense parsing the xml if you don't have to.

When you drop the Folder Stage and create an output link, load the built-in table definition onto it (it's in the Table Defs/Built-in category). Your contents will go into the column called "Record".

The Connectors were updated awhile back for xml types of columns, but do some careful testing independently before you include the xml.

Ernie

Posted: Tue Apr 22, 2014 8:23 pm
by qt_ky
Just to clarify, do you want to dump it into a DB2 column with a data type of CLOB or XML, and not parse the XML or validate it?

Posted: Wed Apr 23, 2014 3:59 pm
by yugee
Try declaring your input column as SQLtype - LongVarChar, Extented - Unicode and don't mention the length