xmlcsvxsdmap-force

How to remove all empty tags using MapForce (csv to xml)? Looking to suppress empty node outputs


I need to write either to a ND element or to a data element. To do this I'm using a filter, where if a ND field is detected it creates the ND element and writes the ND code, and if it isn’t ND data it creates the associated xml tag and writes the data there. However, if I have anything connected to the ND element tag (a connection to the node), it creates an empty self-closing tag (e.g. <NoDataOptn/>). But something must be connected otherwise it will never be able to write ND codes there.

For example below (this is XML code output from MapForce), it places the date correctly in PoolAddtnDt but writes an empty self-closing tag for the no data option below the date. When it writes ND tags it works perfectly (see RpDt, it doesn’t create an empty tag for the date).

Is there a way to remove all the empty tags that are generated this way? Or suppress the output of the nodes.

I've looked into the xsd file and tried setting the minOccurs to 0, as well as nillable to true.

<ActvtyDtDtls>
           <PoolAddtnDt>
                          <Dt>2008-09-01</Dt>     
                          <NoDataOptn/> - i want all these empty tags gone
           </PoolAddtnDt>
           <RpDt>
                          <NoDataOptn>
                                         <NoData>ND5</NoData>
                          </NoDataOptn>
           </RpDt>
</ActvtyDtDtls>

Solution

  • Found the solution. You must (also) connect a filter output to the parent element which must be suppressed as well.