Page 1 of 1

values are combined in repetitive tags of xml output

Posted: Thu Sep 25, 2008 3:37 pm
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.

Posted: Thu Sep 25, 2008 3:52 pm
by Abu@0403
My job is designed as follows

Sequential File ----> Transformer ---------> XML Output Stage

Posted: Fri Sep 26, 2008 6:21 pm
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.

Posted: Sat Sep 27, 2008 3:13 pm
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

Posted: Tue Sep 30, 2008 12:59 pm
by Abu@0403
Yes, i thought the way you have mentioned, but is there any simple way to solve this problem.

Posted: Tue Sep 30, 2008 2:05 pm
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

Posted: Wed Oct 08, 2008 9:34 am
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.

Posted: Wed Oct 08, 2008 9:46 am
by chulett
While this is generally not a problem, you can change the Data Element to XML to prevent that from happening.

Posted: Fri Oct 10, 2008 10:24 am
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.