Page 1 of 1

XML Write Header and Footer - CData

Posted: Sun Apr 14, 2019 6:37 pm
by kaasko
Hi All,

I'm trying to write an XML using DS and ive managed to create all the repeated elements using key and trigger columns;Special thanks to Ernie on his posts about xml. Now i need to add header and footer outside of the element tag and these should have free form text that is of CDATA. (ex: <Header>
<![CDATA[ message ]]>
</Header>

I've found a post that tells me use hash files and a lookup to use, however as I'm using 11.5 is there an alternative to this?


Also, how do we get this free form text tag <![CDATA[ message ]] using Datastage xsd. I've changed the datatype to char and dataelement type as xml but not able to achieve this

For every column description, my fields have /root/<elementtagname>/<columnname>/text() -- So, for achieving CDATA , is there any specific datatype that I need to use or somefeature that I'm missing

Thanks in advance


kaasko

Re: XML Write Header and Footer - CData

Posted: Sun Apr 14, 2019 8:10 pm
by chulett
kaasko wrote:I've found a post that tells me use hash files and a lookup to use, however as I'm using 11.5 is there an alternative to this?
Welcome!

What you found was (I assume) a very old post but your issue isn't the version as it's still a perfectly valid solution. Instead, it was for Server jobs and (again, I assume) you are only looking for a Parallel solution. Ernie is still The Man when it comes to XML discussions here, hopefully he'll be able to pop in and help out. I'm sure someone will. I never had a chance to use the new PX XML stages before I moved on, so can't help there. :(

Posted: Mon Apr 15, 2019 7:34 pm
by eostic
Thank you for the kind words. Glad these resources have been helpful. I havent done cdata stuff in awhile, but recall researching this in depth and concluding that it cant be done with the hierarchical stage.....needing still the xmlOutput Stage....which, for subtle reasons like this, is still fully supported.

Also, if you dont have high volumes, use Server. It is far superior to EE for handling low volume xml because it loves variable text, which is what all xml essentially is.

Posted: Mon Apr 15, 2019 7:40 pm
by chulett
... and when he says "high volumes" he means HIGH volumes. We worked with pretty dang huge volumes of XML data back in the day using Server jobs for consumption by various search engines. Ah, those were the days when Server jobs weren't... pariah. :cry:

Posted: Tue Apr 16, 2019 10:52 pm
by kaasko
Thankyou so much for the inputs and for the welcome(i've only been a stalker in this forum for years and has been my first post officially :P).. and haha I do miss those server job days. But unfortunately I'm dealing with banks data :shock: :shock: and yes HIGH VOLUMES.

I've managed to hardcode the ''CDATA xyzzz " as string thru transformer and in xml output stage - i've defined this column as xml element . And the entire string is adjusted to ---[[CDATA ]] --- with the blue tags as required.

Now , I've an another issue with the tags - i've non repetive columns in my output records - and each run is appending all the tags(including parent tags and child) multiple times as many as the records are there. Is there a way where I can group the child tags into one parent tag.


Cheers
kaasko

Posted: Wed Apr 17, 2019 4:53 pm
by eostic
I can imagine some possibilities, but there is too much room for interpretation. Can you describe the issue in a bit more detail? ...perhaps outline some of the resulting xml you are seeing and what you "want" to see?

Thanks.

Ernie