XML Writer Repeating Elements

Hi I’ve configured a nested mapping for my XML Writer which appears to work, but I’m getting unwanted repeating elements:

Input:

** **Port 0:** **key: 0001** **Port 1:** **key: 0001** **evtType: ADD** **Port 2:** **key: 0001** **Port 3:** **key: 0001** **srcCode: SRCA** **memIdnum: 0001** **Port 4:** **key: 0001** **attrCode: ATTRA** **dataA1: blahA1** **dataA2: blahA2** **...** **Port 5:** **key: 0001** **attrCode: ATTRB** **dataB1: blahB1** **dataB2: blahB2** **...** **

My mapping looks like this:

** **<Mapping** **inPort="0"** **element="EmpiMsg"** **key="key"** **fieldsIgnore="key" >** **<Mapping** **inPort="1"** **element="MsgHeader"** **key="key"** **parentKey="key"** **fieldsIgnore="key" >** **</Mapping>** **<Mapping** **inPort="2"** **element="Member"** **key="key"** **parentKey="key"** **fieldsIgnore="key" >** **<Mapping** **inPort="3"** **element="MemHead"** **key="key"** **parentKey="key" >** **</Mapping>** **<Mapping** **inPort="4"** **element="ATTRA"** **key="key"** **parentKey="key"** **fieldsIgnore="key" >** **</Mapping>** **<Mapping** **inPort="5"** **element="ATTRB"** **key="key"** **parentKey="key"** **fieldsIgnore="key" >** **</Mapping>** **</Mapping>** **</Mapping>** **

I’m expecting to see:

** **<?xml version="1.0" encoding="ISO-8859-1"?>** **<EmpiMsg>** **<MsgHeader>** **<evtType>ADD</evtType>** **</MsgHeader>** **<Member>** **<MemHead>** **<srcCode>SRCA</srcCode>** **<memIdnum>0001</memIdnum>** **</MemHead>** **<ATTRA>** **<attrCode>ATTRA</attrCode>** **<dataA1>blahA1</dataA1>** **<dataA2>blahA2</dataA2>** **</ATTRA>** **<ATTRB>** **<attrCode>ATTRB</attrCode>** **<dataB1>blahB1</dataB1>** **<dataB2>blahB2</dataB2>** **</ATTRA>** **</Member>** **</EmpiMsg>** **

But I’m actually seeing repeating segments of the same data even though there’s only one input record:

** **<?xml version="1.0" encoding="ISO-8859-1"?>** **<EmpiMsg>** **<MsgHeader>** **<evtType>ADD</evtType>** **</MsgHeader>** **<Member>** **<MemHead>** **<srcCode>SRCA</srcCode>** **<memIdnum>0001</memIdnum>** **</MemHead>** **<ATTRA>** **<attrCode>ATTRA</attrCode>** **<dataA1>blahA1</dataA1>** **<dataA2>blahA2</dataA2>** **</ATTRA>** **<ATTRB>** **<attrCode>ATTRB</attrCode>** **<dataB1>blahB1</dataB1>** **<dataB2>blahB2</dataB2>** **</ATTRA>** **</Member>** **<Member>** **<MemHead>** **<srcCode>SRCA</srcCode>** **<memIdnum>0001</memIdnum>** **</MemHead>** **<ATTRA>** **<attrCode>ATTRA</attrCode>** **<dataA1>blahA1</dataA1>** **<dataA2>blahA2</dataA2>** **</ATTRA>** **<ATTRB>** **<attrCode>ATTRB</attrCode>** **<dataB1>blahB1</dataB1>** **<dataB2>blahB2</dataB2>** **</ATTRA>** **</Member>** **<Member>** **<MemHead>** **<srcCode>SRCA</srcCode>** **<memIdnum>0001</memIdnum>** **</MemHead>** **<ATTRA>** **<attrCode>ATTRA</attrCode>** **<dataA1>blahA1</dataA1>** **<dataA2>blahA2</dataA2>** **</ATTRA>** **<ATTRB>** **<attrCode>ATTRB</attrCode>** **<dataB1>blahB1</dataB1>** **<dataB2>blahB2</dataB2>** **</ATTRA>** **</Member>** **</EmpiMsg>** **

Any ideas why or how to fix it? Or any better approaches?

Thanks!

Hello Brett,

What version of CloverETL do you use for that?

This bug has been fixed some time ago and it works correctly in current version of CloverETL.

The result of the same graph in 2.7.2/2.2.2 CloverETL is as follows:


<?xml version="1.0" encoding="UTF-8"?>
<root component="XML_WRITER0" graph="XMLWriter_20090729" created="Wed Jul 29 09:42:01 CEST 2009">
  <EmpiMsg>
    <MsgHeader>
      <envType>ADD</envType>
    </MsgHeader>
    <Member>
      <MemHead>
        <key>0001</key>
        <srcCode>SRCA</srcCode>
        <medIdnum>0001</medIdnum>
      </MemHead>
      <ATTRA>
        <attrCode>ATTRA</attrCode>
        <dataA1>blahA1</dataA1>
        <dataA2>blahA2</dataA2>
      </ATTRA>
      <ATTRB>
        <attrCode>ATTRB</attrCode>
        <dataB1>blahB1</dataB1>
        <dataB2>blahB2</dataB2>
      </ATTRB>
    </Member>
  </EmpiMsg>
</root>

Maybe you have older version of CloverETL?

Best regards

Tomas Waller

Many thanks Tomas,

Yes, its a older version 2.0.3. But it’s an OEM embedded version of Clover, so I don’t really have the ability to upgrade it myself.

I’ll talk to my R&D folks and see what we can do about the version, but in the mean time do you know of any workarounds to this issue?

-Brett.