1
0
-1

Hi,

I have recently starting to use Daffodil for one of my project that parsing DFDL binary files.

I have noted that the dfdl:discriminator annotation does not handle hexBinary data type.

example: <dfdl:discriminator>{../key2 eq xs:hexBinary('10')}</dfdl:discriminator>

throws the exception: Schema Definition Error: Cannot compare HexBinary with HexBinary for operator 'eq'


Is there a plan to support this in the future? Or is there a work-around?

Thanks for your help,

Yvon

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      This is a bug, current marked as DFDL-1618 and slated to be fixed in the 2.1.0 release.

      Fortunately, there is a workaround, which is to cast the xs:hexBinary field to a string and then do a string comparison. For example:

      <dfdl:discriminator>{xs:string(../key2) eq "10"}</dfdl:discriminator>
        CommentAdd your comment...
      1.  
        1
        0
        -1

        Thanks Stephen for the quick answer and the easy workaround, 

        Yvon

          CommentAdd your comment...