[dfdl-wg] How to deal with variable length elements?

Robert E. McGrath mcgrath at ncsa.uiuc.edu
Tue Mar 14 09:25:26 CST 2006


Folks,

I'm trying to build up a story about how to handle arrays using DFDL.  

But first, I need to check if I understand the basics.

Here is an example of a 1D array in XML, modeled as two elements,
an integer indicating how many elements, followed by an array of zero 
or more floats.

Looking at my XML textbooks, the following seems like the correct XML
schema for this notion.

+++

<!-- global type -->
<xs: element type="float" name="floatType" \>

<!-- use global type to read  -->
<xs:complexType name="floatArray">
    <xs:sequence>
        <xs:element name="nelems type="int" />
        <xs:element name="x" ref="floatType" minOccurs="0"  
maxOccurs="./nelems" />
    </xs:sequence>
</xs:complexType>

+++

Do I have this correct? (I'm pretty sure the 'maxOccurs' isn't correct,
so I hope someone will tell me the right way to do this.)

If so, the next question will be "how do I annotate this with DFDL?",
e.g., when the data is precisely one binary (or text encoded) int, followed
by some binary (or text encoeded) floats.





More information about the dfdl-wg mailing list