Page 1 of 1

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

Posted: Sun Nov 21, 2010 11:47 pm
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

Posted: Mon Nov 22, 2010 1:29 am
by ray.wurlod
Mark the output as XML. No conversion will occur. Search DSXchange for details of the technique.

Posted: Mon Nov 22, 2010 3:10 am
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

Posted: Mon Nov 22, 2010 5:25 am
by ray.wurlod
That's what I meant with "mark as XML". Too used to it, I guess.