Page 1 of 1

Duplicates issue in XML OUTPUT STAGE to generate xml

Posted: Thu Sep 10, 2009 11:18 am
by tanmaya
Hi,

I am using XML output stage to generate an xml file. I am able to generate the xml file also but the issue is with the structure of the xml file.

Below are a sample records for which the xml file was generated.

1) "100256","Dsm","410","E","A"
2) "100257","Dsm","410","E","A"
3) "100260","Dsm Ii","412","E","A"

The sample of the xml generated was like given below.If you see the xml generated it shows that it has clubbed together the tags for the code 100256 and 100257, Is is probably because they have all of there other associated values same. Please help me out with this issue as I want it to generate seperate xml tags for both of them like the one created for code 100260.

<ns1:updateRequest>
<ns1:jobList>
<ns1:job>
<ns1:code>100256</ns1:code>
<ns1:code>100257</ns1:code>
<ns1:description>Dsm</ns1:description>
<ns1:salaryPayGrade>410</ns1:salaryPayGrade>
<ns1:flsaStatus>E</ns1:flsaStatus>
<ns1:effectiveStatus>A</ns1:effectiveStatus>
</ns1:job>
<ns1:job>
<ns1:code>100260</ns1:code>
<ns1:description>Dsm Ii</ns1:description>
<ns1:salaryPayGrade>412</ns1:salaryPayGrade>
<ns1:flsaStatus>E</ns1:flsaStatus>
<ns1:effectiveStatus>A</ns1:effectiveStatus>
</ns1:job>
</ns1:jobList>
</ns1:updateRequest>

Posted: Thu Sep 10, 2009 3:22 pm
by eostic
A strange issue indeed. I've found that the easiest way to alleviate this is to ensure that the sub-elements cannot be the same. Add another element as an immediate sub-node and then edit it out afterwards in a downsteam transformer, by sending your output to a single column on the output link...a varchar with large length and just a single "/" in the Description property.

Ernie

Posted: Fri Sep 11, 2009 1:11 am
by tanmaya
Hi Ernie,

Can you please ellaborate on the way in which after adding a new field and then generating a xml how is it possible to remove that extra column. from the generated xml.
If I am getting this wrong please correct me.

Thanks,
Tanmaya

Posted: Sat Sep 12, 2009 6:30 am
by eostic
...there are lots of great string functions in a BASIC Transformer, or...just do the whole Job in a Server Job instead and use a regular transformer....I'd have to see your actual resulting string, but I'll be that a couple of nested ereplace()'s would work just fine.....

Ernie

Posted: Mon Sep 14, 2009 5:55 am
by battaliou
I assume you have xpaths defined for each of these columns? Please can you post them? Including named spaces (NS1:) in your output can be tricky, so you have to be pretty specific at what you're trying to achieve. Setting your "code" column as the repeating group column should resolve your grouping problem.

Try generating your data using XPATH without names spaces e.g
/updateRequest/jobList/job/code
/updateRequest/jobList/job/code/description
etc.

Once you have this working, attempt a version 2 to solve your named space issue.