You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by "Costello, Roger L." <co...@mitre.org> on 2018/12/17 16:23:15 UTC

Why are a sequence of xs:hexBinary bytes affected by byteOrder but a sequence of xs:string bytes are not affected?

Hello DFDL community,

My input file contains a single, 8-byte field:

[cid:image002.png@01D495FA.E6439B60]

My DFDL schema specifies that the field consists of 8 xs:hexBinary bytes:

<xs:element name="Field"
           type="xs:hexBinary"
           dfdl:length="8"
            dfdl:lengthKind="explicit"
dfdl:lengthUnits="bytes" />

Through experimentation I have found that the value of the <Field> element depends on the value of dfdl:byteOrder: If dfdl:byteOrder="littleEndian" then the value of the <Field> element is 11 11 11 11 00 00 00 00. If dfdl:byteOrder="bigEndian" then the value of the <Field> element is 00 00 00 00 11 11 11 11.

Conversely, suppose my input file consists of this single, 8-byte field:

[cid:image006.png@01D495FA.E6439B60]
My DFDL schema specifies that the field consists of 8 xs:string characters:

<xs:element name="Field"
           type="xs:string"
           dfdl:length="8"
            dfdl:lengthKind="explicit"
dfdl:lengthUnits="characters" />

Through experimentation I have found that the value of the <Field> element does not depend on the value of dfdl:byteOrder.

Why is that?

It seems to me that in the first case (above) we have a sequence of bytes and in the second case we also have a sequence of bytes. The only difference being that in the first case the sequence is to be interpreted as a sequence of hex digits whereas in the second case the sequence is to be interpreted as a sequence of characters.

Why this difference in behavior between a sequence of hex digits versus a sequence of characters?

/Roger



Re: Why are a sequence of xs:hexBinary bytes affected by byteOrder but a sequence of xs:string bytes are not affected?

Posted by Steve Lawrence <sl...@apache.org>.
This was just a bug in Daffodil, which was actually fixed last week
(DAFFODIL-2019). The fixed behavior is as you describe--the
dfdl:byteOrder property should not have an affect on the resulting
infoset value when parsing xs:hexBinary data.

- Steve

On 12/17/18 11:23 AM, Costello, Roger L. wrote:
> Hello DFDL community,
> 
> My input file contains a single, 8-byte field:
> 
> My DFDL schema specifies that the field consists of 8 xs:hexBinary bytes:
> 
> <xs:elementname="Field"
>             type="xs:hexBinary"
>             dfdl:length="8"
>              dfdl:lengthKind="explicit"
> 
> dfdl:lengthUnits="bytes"/>
> 
> Through experimentation I have found that the value of the <Field> element 
> depends on the value of dfdl:byteOrder: If dfdl:byteOrder="littleEndian" then 
> the value of the <Field> element is 11 11 11 11 00 00 00 00. If 
> dfdl:byteOrder="bigEndian" then the value of the <Field> element is 00 00 00 00 
> 11 11 11 11.
> 
> Conversely, suppose my input file consists of this single, 8-byte field:
> 
> My DFDL schema specifies that the field consists of 8 xs:string characters:
> 
> <xs:elementname="Field"
>             type="xs:string"
>             dfdl:length="8"
>              dfdl:lengthKind="explicit"
> 
> dfdl:lengthUnits="characters"/>
> 
> Through experimentation I have found that the value of the <Field> element does 
> _not_ depend on the value of dfdl:byteOrder.
> 
> Why is that?
> 
> It seems to me that in the first case (above) we have a sequence of bytes and in 
> the second case we also have a sequence of bytes. The only difference being that 
> in the first case the sequence is to be interpreted as a sequence of hex digits 
> whereas in the second case the sequence is to be interpreted as a sequence of 
> characters.
> 
> Why this difference in behavior between a sequence of hex digits versus a 
> sequence of characters?
> 
> /Roger
>