My input is a 7-character, fixed length field.

The field contains data about one or two airport runways, e.g.,

.../24L-36R/...
.../24L    /...

The L and R are optional, so the field could be these:

.../24     /...
.../24-36  /...

My DFDL schema parses correctly and mostly unparses correctly, but for that 
last example it adds two zeroes instead of two spaces on unparsing.

These:

.../24     /...
.../24-36  /...

parses to these:

<RunwayDesignator>24</RunwayDesignator>

<RunwayDirectionDesignator>
      <RunwayDesignator_1>24</RunwayDesignator_1>
      <RunwayDesignator_2>36</RunwayDesignator_2>
</RunwayDirectionDesignator>

And uparses to these:

.../24     /...
.../24-3600/...

Notice that spaces are properly added in the first case, but zeroes are added 
in the second case. Why is that? Below is my DFDL.

<xs:choice>
    <xs:element name="RunwayDesignator"
            type="RunwayDesignator_simpleType"
                  dfdl:lengthKind="explicit"
                        dfdl:length="7"
            dfdl:textTrimKind="padChar"
               dfdl:textPadKind="padChar"
            dfdl:textStringPadCharacter="%SP;"
            dfdl:textStringJustification="left">
        <xs:annotation>
            <xs:appinfo source=http://www.ogf.org/dfdl/>
                <dfdl:assert>{ dfdl:checkConstraints(.) }</dfdl:assert>
            </xs:appinfo>
        </xs:annotation>
    </xs:element>
    <xs:element name="RunwayDirectionDesignator"
                  dfdl:lengthKind="explicit"
                        dfdl:length="7">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="RunwayDesignator_1"
                        type="RunwayDesignator_simpleType"
                               dfdl:lengthKind="pattern"
                                    dfdl:lengthPattern=".*?(?=[-])"/>
                <xs:sequence dfdl:hiddenGroupRef="hidden-Hyphen"/>
                <xs:element name="RunwayDesignator_2"
                        type="RunwayDesignator_simpleType"
                        dfdl:textTrimKind="padChar"
                           dfdl:textPadKind="padChar"
                        dfdl:textStringPadCharacter="%SP;"
                        dfdl:textStringJustification="left"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:choice>






Reply via email to