XML Format output

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

XML Format output

Post by devanars »

We were required to store the data(merge of two source columns) in xml format of a target table column.

The Req is like this

Source table has columns like A,B and C. Target table has two columns A and D. col A directly can map to target A but source B need to be display in first line and col C in second line of the target coulmn D. The data type of col D is CLOB.hope i have given clear information.

Source:
A B C
10 20 30

Target required format:
A-------------D
10-------<'B> 20 <\B>
----------<C> 30 </C>

any advise regarding the above. Thanks
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

to confirm.....the target that you are looking for is not really "xml"...just that you have certain chunks inside of the target that are "formatted like xml tags"?

...based on what you have below, I'd just use a Transformer and build the string that you need.

How many columns are there? If in fact, there are 20 or 30 B and C columns that need xml tags, then I'd craft a way to use the xml stage, but for only 2 to maybe 10, a transformer is just as easy, especially if you are needing to care about the crlf's..... are the exactly line formats important?

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

We need to get xml tags also for both B and C. Actually we need to get only two columns like that. but both the columns has long text data so that we have assigned data type as CLOB.

Appreciate your help if you can advise the procedure of getting those output with tags. Thanks
Pagadrai
Participant
Posts: 111
Joined: Fri Dec 31, 2004 1:16 am
Location: Chennai

Post by Pagadrai »

Hi,
can you explain the requirement more clearly with 2 sample input records and expected output.

As Ernie said, you can just append the xml tags if that gets you the required result.
Else, you need to use XML output stage for each output column to convert it to XML.
Is your output a DB or a file ?
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

I need to get xml structure at the output. output is a DB.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

and it's just those two columns? Build the xml string in a transformer. Don't waste your time with the xmlOutput Stage. It does far more than you need here for this solution.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

Any sugession to start second line. I need to store two lines on one field. how can i close the first line and start second line. any function is there to use! Just i am hard coding the text in the transformer.Please advise.Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just build them together as one line, formatting like that is just for peoples and will not affect any XML parser. If for some reason you really think you need to do this, concatenate a <CR> between the two elements:

Code: Select all

FirstTag : Char(13) : SecondTag
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply