Hello DFDL community,

My input file is binary, in little endian format. It contains two 2-byte 
values. Each value represents a hex address. My schema reverses the order of 
the bytes in each address. For example, with this hex input:

80 00 10 00

This is the XML that is output:


<input>
    <address1>0080</address1>
    <address2>0010</address2>
</input>

Note that the two bytes in each address are reversed.

Parsing works as desired. However, unparsing generates a strange error:

[warning] BLOCKED
exc=One(org.apache.daffodil.infoset.OutputValueCalcEvaluationException: 
Expression Evaluation Error: Element {}Hidden_address1_byte1 does not have a 
value.
Schema context: Hidden_address1_byte1
node=One(DISimple(name='Hidden_address1_byte1' contentLen(One(0)unk, One(8)unk) 
valueLen(One(0)unk, One(0)DOS(id=0.1))))
info=One(DPathElementCompileInfo(Hidden_address1_byte1))
index=MaybeInt(0)

Below is my schema. What am I doing wrong, please?  /Roger

<xs:element name="two-addresses">
    <xs:complexType>
        <xs:sequence>
            <xs:sequence dfdl:hiddenGroupRef="hidden_address1_Group" />
            <xs:element name="address1" type="xs:string" dfdl:inputValueCalc='{
                fn:concat(xs:string(../Hidden_address1_byte2), 
xs:string(../Hidden_address1_byte1))}'/>
            <xs:sequence dfdl:hiddenGroupRef="hidden_address2_Group" />
            <xs:element name="address2" type="xs:string" dfdl:inputValueCalc='{
                fn:concat(xs:string(../Hidden_address2_byte2), 
xs:string(../Hidden_address2_byte1))}'/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:simpleType name="hexBinary1" dfdl:length="1" dfdl:lengthKind="explicit" 
dfdl:lengthUnits="bytes">
    <xs:restriction base="xs:hexBinary"/>
</xs:simpleType>

<xs:group name="hidden_address1_Group">
    <xs:sequence>
        <xs:element name="Hidden_address1_byte1" type="hexBinary1" 
dfdl:outputValueCalc='{ . }' />
        <xs:element name="Hidden_address1_byte2" type="hexBinary1" 
dfdl:outputValueCalc='{ . }' />
    </xs:sequence>
</xs:group>

<xs:group name="hidden_address2_Group">
    <xs:sequence>
        <xs:element name="Hidden_address2_byte1" type="hexBinary1" 
dfdl:outputValueCalc='{ . }' />
        <xs:element name="Hidden_address2_byte2" type="hexBinary1" 
dfdl:outputValueCalc='{ . }' />
    </xs:sequence>
</xs:group>


Reply via email to