As you can see the top element contains the value AG. I have my output converter set to:
converter:EDI:val=yes:typ=yes:clean=both:rtrim=yes:auto=yes:user=file://path/to/dictionary.sef?file:///path/to/output.edi
As you can see, the 3035 element has no value. However the output EDI reads:
NAD+ +39000'
If I remove the 3035 I get an error that a mandatory element is missing (as I would expect), but with the empty sequence it feeds a whitespace, which ommits the error from being thrown.
Subject:Another EDI problem Author:(Deleted User) Date:27 May 2009 12:37 PM
Roel,
Our defined behavior is that elements like <NAD01-3035ElementType/> will generate a data value. If you want no value, you need to completely eliminate the element.
Subject:Another EDI problem Author:Roel van der Hoeven Date:29 May 2009 02:43 AM
This will generate a lot of work for me, if I have to check for these things EVERY (composite)element. Also this has to have an effect on performance since there will be tons of checking in the entire code.
Subject:Another EDI problem Author:Tony Lavinio Date:10 Aug 2009 03:32 PM
Well, we did some research on this, and here is the definitive answer.
If the EDI element is marked as mandatory and there is an XML element
with empty content, in order to keep from causing an error, we will
pad the element with a single space.
In this case, if the NAD01 element were changed to "optional," as is
appropriate since "" is now a valid value, then the EDI serializer
will write out
<NAD>
<NAD01/>
<NAD02>
<NAD0201><!--3039: Party identifier-->39000</NAD0201>
</NAD02>
</NAD>
as
NAD++39000'
But exactly the same XML will, if NAD01 is mandatory, generate this:
NAD+ +39000'
so that the EDI is valid.
So you do have control, based on the settings in the SEF file.
Subject:Another EDI problem Author:Roel van der Hoeven Date:11 Aug 2009 01:36 AM
To be honest, the whole idea of mandatory fields getting a whitespace to ommit errors does not feel like correct behaviour. If this is the case; why have mandatory elements?
Subject:Another EDI problem Author:Tony Lavinio Date:11 Aug 2009 10:11 AM
If there is an element present in the XML input AND the field is
mandatory, then there is an element forced into the output.
if there is no element present in the XML input OR the field is
optional and empty, then nothing is forced to the output.
This gives the writer of the XML the most control over the generated
EDI.
The alternative would be to throw an error on empty XML elements
writing to mandatory fields, but based on experience with users,
we settled on the current behavior.