Page 1 of 1

Repeating elements in XML Output Stage

Posted: Thu Mar 07, 2013 3:29 pm
by just4geeks
Just wondering if someone can help me with this.

I have this in a flat file.

Code: Select all

020902,020902001,1200110100Z001
020902,020902001,1200110100Z002
The XML schema is this,

Code: Select all

/ORG/CLASS/ITEM/text()
/ORG/PROG/ITEM/text()
/ORG/LINE/LINECODE/ID/text()
Expected output:

Code: Select all

<ORG>
 <CLASS>
  <ITEM>020902</ITEM>
 </CLASS>
 <PROG>
  <ITEM>020902001</ITEM>
 </PROG>
  <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z001</ID>
  </LINECODE>
 </LINE>
 <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z002</ID>
  </LINECODE>
 </LINE>
 </ORG>
But what I get is, this. The ORG tags are repeating. How do I make it not repeat for every new /ORG/LINE/LINECODE/ID.

Code: Select all

<ORG>
 <CLASS>
  <ITEM>020902</ITEM>
 </CLASS>
 <PROG>
  <ITEM>020902001</ITEM>
 </PROG>
 <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z001</ID>
  </LINECODE>
 </LINE>
</ORG>
<ORG>
 <CLASS>
  <ITEM>020902</ITEM>
 </CLASS>
 <PROG>
  <ITEM>020902001</ITEM>
 </PROG>
 <LINE>
  <LINECODE IdentificationSystem="VA">
   <ID>1200110100Z002</ID>
  </LINECODE>
 </LINE>
</ORG>
Any ideas are welcome.

Posted: Thu Mar 07, 2013 4:56 pm
by rameshrr3
Which column[Xpath] have you tagged as the key column of XML output stage ? It should be the ID tag

Posted: Thu Mar 07, 2013 11:48 pm
by prasannakumarkk
What is the option you have checked?
1) Aggregate rows
2) Single Row
3) Key column

Posted: Fri Mar 08, 2013 7:05 am
by just4geeks
rameshrr3 wrote:Which column[Xpath] have you tagged as the key column of XML output stage ? It should be the ID tag
When I set the ID tag as the key, it appears to work fine until I have two instances of /ORG/PROG/ITEM/text()

Code: Select all

020902,[b]020902001[/b],1200110100Z001 
020902,[b]020902002[/b],1200110100Z002
This is the output I get,
<ORG>
<CLASS>
<ITEM>020902</ITEM>
</CLASS>
<PROG>
<ITEM>020902001</ITEM>
</PROG>
<LINE>
<LINECODE IdentificationSystem="VA">
<ID>1200110100Z001</ID>
<ID>1200110100Z002</ID>
</LINECODE>
</LINE>
</ORG>
<ORG>
<CLASS>
<ITEM>020902</ITEM>
</CLASS>
<PROG>
<ITEM>020902002</ITEM>
</PROG>
<LINE>
<LINECODE IdentificationSystem="VA">
<ID>1200110100Z001</ID>
<ID>1200110100Z002</ID>
</LINECODE>
</LINE>
</ORG>

Posted: Fri Mar 08, 2013 7:05 am
by just4geeks
prasannakumarkk wrote:What is the option you have checked?
1) Aggregate rows
2) Single Row
3) Key column
Aggregate rows.

Posted: Mon Mar 11, 2013 6:36 am
by eostic
It's not exactly clear to me what you "want" to get, or what the exact issue is. Can you provide a bit more detail and explanation?

Thanks.

Ernie

Posted: Mon Mar 11, 2013 7:32 am
by just4geeks
eostic wrote:Can you provide a bit more detail and explanation?
Hi Ernie, I agree I wasn't elaborate on my question. Fortunately, this question isn't relevant anymore due to job design changes and I have been confronted with another similar yet perplexing XML problem. I will be posting the question in a new thread.

Update:
The new thread is here viewtopic.php?p=437969