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