passing value as tag 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
sravanthi
Participant
Posts: 83
Joined: Fri Jun 02, 2006 5:37 am

passing value as tag in xml

Post by sravanthi »

Hi

I have a scenario where i have to pass the value of a column as tag dyanamically.

ex:

name values(abcd,xyz)
id values(11,22)

expected output should be
<work>
<abcd>
11
</abcd>
</work>
<work>
<xyz>
22
</xyz>
</work>

I have given tags as :
/root/work/@name
/root/work/value/text()

I'm getting the output as :
<work>
<name ="abcd">
<value>
11
</value>
</name>
<name ="xyz">
<value>
22
</value>
</name>
</work>

Can anyone suggest some solution for this!

thanks!
sravanthi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Those are XPath Expressions not 'tags' that generate the XML output in your job. And you get the 'name = "xxx"' elements because of the use of the '@'.

I'm not positive you can generate output like that without doing your own 'tag building' or XML creation. What I would suggest you try is to take a sample output file you've built (or better yet an .xsd if you have one) and import the metadata for it via the Manager. See what kind of XPath Expressions it creates for the file and try those in your job.
-craig

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