How to handdle chars '<' and '>' in XML Output Stage

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
YankeeYank
Participant
Posts: 2
Joined: Sun Nov 21, 2010 12:47 pm

How to handdle chars '<' and '>' in XML Output Stage

Post by YankeeYank »

Hello DS Experts,

I am trying to generate an XML using XML output Stage. Job design is

DataSet ------> Transformer ---------> XML Output

I have used following code in derivation of a column in Transformer

Code: Select all

'<NUMBER><NUM_TYPE>PAN</NUM_TYPE><NUM_VALUE>':NullToEmpty(DSLink2.PAN):'</NUM_VALUE>' 
I have got following output in XML
<NUMBER><NUM_TYPE>PAN</NUM_TYPE><NUM_VALUE>1234567890</NUM_VALUE>
I have even tried escaping as

Code: Select all

'\<NUMBER\>\<NUM_TYPE\>PAN\</NUM_TYPE\>\<NUM_VALUE\>':NullToEmpty(DSLink2.PAN):'\</NUM_VALUE\>
and got output as
\<NUMBER\>\<NUM_TYPE\>PAN\</NUM_TYPE\>\<NUM_VALUE\>1234567890\<
Please suggest is there any way to escape chars '<' and '>' in XML output Stage.

Best Regards

Rahul
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Mark the output as XML. No conversion will occur. Search DSXchange for details of the technique.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
YankeeYank
Participant
Posts: 2
Joined: Sun Nov 21, 2010 12:47 pm

Post by YankeeYank »

Hi Ray,

Thanks a lot . Issue got resolved using Craig solution
Set the 'Data Element' to XML for the chunk data so it knows it is already XML and doesn't make that conversion.
Regards

Rahul
Do your best n leave the rest :)
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's what I meant with "mark as XML". Too used to it, I guess.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply