Hi Mike,

but if I want to read a number of bytes which size is defined by another 
property, then things get complicated/impossible.

I am currently trying to separate the reading of bits/bytes which is sort of 
language dependent into a language-dependent IO module
and have the structure of the message use these globally defined types to 
generate the datatypes and the parsers/serializers.

So for now I’ll probably have to give up the ability to run my schemas in 
daffodil …
I would have liked to continue as I really liked things like the test-suite 
stuff and such, but right now it’s this which is causing trouble …
perhaps we’ll come up with exceptions for hexByte and string and will allow 
only there to be defined inline and force the rest to be imported.

Chris


Von: "Beckerle, Mike" <[email protected]>
Antworten an: "[email protected]" <[email protected]>
Datum: Mittwoch, 8. Mai 2019 um 17:18
An: "[email protected]" <[email protected]>
Betreff: Re: Some sort of "abstract" types?


Alas, the DFDL Workgroup made a "conservative design choice" a long while back 
to disallow overlapping properties between referencer and referencee, where 
those referencing scenarios are:



element -> type def

elementRef -> element decl

groupRef -> model group of group def

simple type def -> simple base type def



The rationale for this was that we could always loosen this restriction in the 
future, but some of the committee members believed this restriction would 
simplify implementation complexity.



To achieve roughly what you want you have to do:



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

<xs:simpleType name="data1"  dfdl:length="1">
    <xs:restriction base="tns:dataN"/>
</xs:simpleType>
Then at your points of use of the type, you use data1 or dataN accordingly.



________________________________
From: Christofer Dutz <[email protected]>
Sent: Wednesday, May 8, 2019 10:36:34 AM
To: [email protected]
Subject: Some sort of "abstract" types?


HI,



I am currently working on a first code-generator for my DFDL schemas … as 
implementing the full spec is completely out of question as it’s just far to 
feature-rich and hereby complex to implement, I am currently refactoring my 
schemas to allow everything I need, but as simple as possible. While I was able 
to come up with solutions for most things, one thing is a little annoying:



We have an element like this:

<xs:element name="data" type="xs:hexBinary"
            dfdl:byteOrder="bigEndian" dfdl:lengthUnits="bytes" 
dfdl:lengthKind="explicit"
            dfdl:length="{../../parameterLength}"/>



We moved the definition of all types to the top in “simpleType” elements and 
simply reference “plc4x:uint8” for example, however we can’t do that with these 
as we can’t override the “length” later on …

I would have preferred something like this:

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



And then override the length where needed:

<xs:element name="data" type="plc4x:data" 
dfdl:length="{../../parameterLength}"/>



Are there any options to do such a thing and I just haven’t found them yet?



Chris














Reply via email to