Hi Folks,

I request a new option be added to Daffodil. I don't have a name for the 
option, but here's the intent of the option:

        When an element in the schema has a simpleType
        that contains facets, use those facets to specify
        the content of a data field.

For example, with this element declaration:

<xs:element name="LatitudeDegrees">
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:pattern value="[0-9]{2}" />
        </xs:restriction>
    </xs:simpleType>
</xs:element>

The pattern facet specifies that the field is two digit characters.

Today, I can't do that. Instead, I have to add two DFDL properties to specify 
that the field's length is two:

<xs:element name="LatitudeDegrees"
                       dfdl:lengthKind="explicit"
                       dfdl:length="2">
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:pattern value="[0-9]{2}" />
        </xs:restriction>
    </xs:simpleType>
</xs:element>

There should be no reason for having to add those DFDL properties. The XSD 
pattern facet already tells you that the length is two. 

Now, you might argue: "What's so hard about adding those two properties?" 

You are correct for this specific instance. It's easy if we are building the 
DFDL schema manually, hardcoding every XSD element declaration.

But if we want to write a program that can input arbitrary XSD and 
automatically apply the appropriate DFDL properties, then things aren't so 
easy. Case in point:

Write a program that inputs an arbitrary sequence of XSD element declarations. 
The sequence of elements represent the parts of one data field. Each part may 
be of fixed or variable length. There is no separator between the parts. The 
parts are non-nillable. The program must output the element declarations with 
the appropriate DFDL properties added.

It is probably impossible to write such a program with today's DFDL. Or at 
least, very difficult.

If DFDL leveraged the XSD facets, then that would greatly simplify the DFDL 
schema. And, it would enable programs to be written to automate the production 
of DFDL schemas.

I recommend including such an option in the next release of Daffodil.

I thought that the -V limited option was doing what I describe above. Sadly, I 
realized today that it doesn't. 

/Roger

Reply via email to