Dynamic Tags in Xml

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
tiozzo
Charter Member
Charter Member
Posts: 38
Joined: Fri Sep 01, 2006 3:07 pm

Dynamic Tags in Xml

Post by tiozzo »

Want to create dynamic tags in a xml:

following is the table to pickup the data:

Keytag Maintag Subtag Value
-------- --------- ------ -----
PC A X 1
PC B X 4
KB B X 6
HD A X 2
HD B X 7


Desired Result (xml):
--------------------------
<PC><A><X>1</X></A><B><X>4</X></B></PC>
<KB><B><X>6</X></B></KB>
<HD><A><X>2</X></A><B><X>7</X></B></HD>
VCInDSX
Premium Member
Premium Member
Posts: 223
Joined: Fri Apr 13, 2007 10:02 am
Location: US

Post by VCInDSX »

Check out Duke's link http://www.duke-consulting.com/Download ... ctices.zip for a best practices document which has use cases for many XML scenarios. You should be able to achieve it with the help of this document.

Do you have an XSD for your output XML?

Good luck,
-V
tiozzo
Charter Member
Charter Member
Posts: 38
Joined: Fri Sep 01, 2006 3:07 pm

Post by tiozzo »

I dont have XSD for my output xml file.
I am getting following error when trying to assign "XML" as data Element to my xml chunk. So that i can join it with main xml. Do i need to create XSD for xml ?

"the data element selected is not compatible with sql data type."
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

That's an error I haven't seen before in relation to XMLOutput..... Can we assume that your SQL data type is char/varchar/longvarchar ?

Ernie
tiozzo
Charter Member
Charter Member
Posts: 38
Joined: Fri Sep 01, 2006 3:07 pm

Post by tiozzo »

eostic wrote:That's an error I haven't seen before in relation to XMLOutput..... Can we assume that your SQL data type is char/varchar/longvarchar ?

Ernie
Im using VARBINARY data type and XML as data element for the xml chunk data.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

What's in your XML content that you need varbinary? I'm not surprised that it is upset. It's probably expecting pure text....
Post Reply