values are combined in repetitive tags of xml output

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Abu@0403
Participant
Posts: 32
Joined: Wed Aug 08, 2007 11:21 pm

values are combined in repetitive tags of xml output

Post by Abu@0403 »

Hi All,

I face a problem in using xml output stage.

I need the output as

<member>
<attname> FST_NAME </attname>
<attvalue> Abu </attvalue>
<atttype> 1 </atttype>
<phone> P </phone>
<attname> LST_NAME </attname>
<attvalue> Mamar </attvalue>
</member>

But I get it as

<member>
<attname>
FST_NAME
LST_NAME
</attname>
<attvalue>
Abu
Mamar
</attvalue>
<atttype> 1 </atttype>
<phone> P </phone>
</member>

I want FST_NAME and LST_NAME in separate tags and in the order I expect. But here it gets grouped under a single tag.

The reason is that Description is same for both FST_NAME and LST_NAME.

/member/attname/text()

Similarly

/member/attvalue/text()

Can anyone suggest me a solution.
----------------
Abu
Abu@0403
Participant
Posts: 32
Joined: Wed Aug 08, 2007 11:21 pm

Post by Abu@0403 »

My job is designed as follows

Sequential File ----> Transformer ---------> XML Output Stage
----------------
Abu
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Used to be a bug in that DataStage could not process 2 repeating groups in one stage. You should be able create a lookup out of one repeating group from the other to combine them.
Mamu Kim
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Another way to look at it is that it's a poorly designed document. Those are simply two instances of the same set of tags, that ought to be wrapped by some other element (like attGroup or something).

If it's only LST_NAME (and not 150 other columns also) that you have to worry about, an easy solution may be to just manually construct those few elements in a transformer and then include them in the final XMLOutput....give them a data element of XML so that they don't get tagged and include them in the proper place in the syntax by just using a .../.../.../ in the xpath.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Abu@0403
Participant
Posts: 32
Joined: Wed Aug 08, 2007 11:21 pm

Post by Abu@0403 »

Yes, i thought the way you have mentioned, but is there any simple way to solve this problem.
----------------
Abu
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

as I suggested, I think the easiest way to do this is to simply build the tags manually in a transformer.....simple provided that it's only a few columns. Just concatenate the values with the right tag strings and place into a string column that is pushed to XMLOutput along with your other column that works. Give it a data element of XML... takes some experimentation, but works. Look also at the Best PRactices document on Kim Duke's site (and mentioned in many other threads here), as it shows how to use the techqnique of putting together pre-constructed XML strings, albeit for a different reason.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Abu@0403
Participant
Posts: 32
Joined: Wed Aug 08, 2007 11:21 pm

Post by Abu@0403 »

I face a problem when I try to code the way you have mentioned eostic. The tag for eg <abc> is replaced as "<abc&gt:" in the output file. Actually "<" is replaced as "<" and ">" as ">" as markup value. Is there any way to solve this problem.
----------------
Abu
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

While this is generally not a problem, you can change the Data Element to XML to prevent that from happening.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Abu@0403
Participant
Posts: 32
Joined: Wed Aug 08, 2007 11:21 pm

Post by Abu@0403 »

Yah this solved the problem.

Thanks a lot.

But coming back to my original question. Is there any way to avoid repetitive tags to be grouped or is it like it cant be done in Datastage.

Can anyone of you confirm on this.
----------------
Abu
Post Reply