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 2019/08/26 16:29:09 UTC

Why do I get this warning message: DFDL property was ignored: representation="text"

Hello DFDL community,

My input is a binary file. I want my DFDL schema to consume hexBinary bytes until it gets to the string "This program cannot be run in DOS mode".

Parsing the input with the below DFDL schema results in this warning message:

[warning] Schema Definition Warning: DFDL property was ignored: representation="text"

Why?

The DFDL schema worked fine in Daffodil version 2.3.0 but now in 2.4.0 I get the above warning.   /Roger

<xs:element name="DOS_Stub">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Instructions" type="xs:hexBinary"
                dfdl:lengthKind="pattern"
                dfdl:lengthPattern="[\x00-\xFF]+?(?=This program cannot be run in DOS mode\.)" />
            <xs:element name="Message" type="xs:string"
                dfdl:lengthUnits="characters"
                dfdl:lengthKind="explicit"
                dfdl:length="39"
                dfdl:representation="text"
                dfdl:encoding="ISO-8859-1" />
        </xs:sequence>
    </xs:complexType>
</xs:element>




Re: Why do I get this warning message: DFDL property was ignored: representation="text"

Posted by Steve Lawrence <sl...@apache.org>.
Since it never makes sense to have a string with
representation="binary", when the type is xs:string the representation
is always implied to be "text". We don't even bother looking at the
value of representation--it's just completely ignored.

A new feature in Daffodil 2.4 warns when properties are ignore, so you
now get a warning when representation is defined on string elements.
Functionally, it's exactly the same as in 2.3, you just now get a warning.

To get rid of the warning, you can either turn it off by disabling the
"ignoreDFDLProperty" warning, or you can just remove the
dfdl:representation="text" property from that element. I'd recommend the
latter as it is actually pretty good at finding legitimate bugs in schemas.

Note that for hexBinary, the representation is always implied to by
"binary", so you also never need representation on elements with
xs:hexBinary types.


On 8/26/19 12:29 PM, Costello, Roger L. wrote:
> Hello DFDL community,
> 
> My input is a binary file. I want my DFDL schema to consume hexBinary bytes 
> until it gets to the string “/This program cannot be run in DOS mode/”.
> 
> Parsing the input with the below DFDL schema results in this warning message:
> 
> *[warning] Schema Definition Warning: DFDL property was ignored: 
> representation="text"*
> 
> Why?
> 
> The DFDL schema worked fine in Daffodil version 2.3.0 but now in 2.4.0 I get the 
> above warning.   /Roger
> 
> <xs:elementname="DOS_Stub">
> <xs:complexType>
> <xs:sequence>
> <xs:elementname="Instructions"type="xs:hexBinary"
>                  dfdl:lengthKind="pattern"
>                  dfdl:lengthPattern="[\x00-\xFF]+?(?=This program cannot be run 
> in DOS mode\.)"/>
> <xs:elementname="Message"type="xs:string"
>                  dfdl:lengthUnits="characters"
>                  dfdl:lengthKind="explicit"
>                  dfdl:length="39"
> dfdl:representation="text"
>                  dfdl:encoding="ISO-8859-1"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>