Thank you Brandon!

Upon experimentation, I found that Daffodil does not currently support 
dfdl:occursCountKind="stopValue"

Daffodil team: when will stopValue be supported?

Your other suggestion works great:

<xs:element name="input">
    <xs:complexType>
        <xs:sequence dfdl:separator="%NL;"
                               dfdl:separatorPosition="infix">
            <xs:element name="fruit" type="xs:string"
                                maxOccurs="unbounded"
                                dfdl:occursCountKind="parsed">
                <xs:annotation>
                    <xs:appinfo source="http://www.ogf.org/dfdl/";>
                        <dfdl:assert test="{. ne '----'}" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
            <xs:sequence dfdl:hiddenGroupRef="separatorGroup" />
            <xs:element name="wood" type="xs:string"
                                maxOccurs="unbounded"
                                dfdl:occursCountKind="parsed">
                <xs:annotation>
                    <xs:appinfo source="http://www.ogf.org/dfdl/";>
                        <dfdl:assert test="{. ne '----'}" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
            <xs:sequence dfdl:hiddenGroupRef="separatorGroup" />
            <xs:element name="color" type="xs:string"
                                maxOccurs="unbounded"
                                dfdl:occursCountKind="implicit" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

From: Sloane, Brandon <[email protected]>
Sent: Tuesday, July 23, 2019 2:23 PM
To: [email protected]
Subject: [EXT] Re: Can't have an array of arrays?


In your case, I believe you want to use dfdl:occursCountKind="stopValue".



I am not 100% sure this feature is implemented in Daffodil yet. If not, you 
would want to use dfdl:occursCountKind="parsed", and put an assert on each of 
your types that they are not the value "----"

________________________________
From: Costello, Roger L. <[email protected]<mailto:[email protected]>>
Sent: Tuesday, July 23, 2019 2:08:18 PM
To: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>>
Subject: Can't have an array of arrays?

Hello DFDL community,

My input contains an array of fruit values, separator, array of wood values, 
separator, and an array of color values:

Apple
Banana
Orange
Watermelon
Grapes
Cantaloupe
----
Oak
Pine
Maple
----
Red
Green
Purple
Blue

I thought this DFDL schema would do the trick:

<xs:element name="input">
    <xs:complexType>
        <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="infix">
            <xs:element name="fruit" type="xs:string" maxOccurs="unbounded"
                       dfdl:occursCountKind="implicit" />
            <xs:sequence dfdl:hiddenGroupRef="separatorGroup" />
            <xs:element name="wood" type="xs:string" maxOccurs="unbounded"
                       dfdl:occursCountKind="implicit" />
            <xs:sequence dfdl:hiddenGroupRef="separatorGroup" />
            <xs:element name="color" type="xs:string" maxOccurs="unbounded"
                       dfdl:occursCountKind="implicit" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:group name="separatorGroup">
    <xs:sequence>
        <xs:element name="separator" type="xs:string">
            <xs:annotation>
                <xs:appinfo source="http://www.ogf.org/dfdl/";>
                    <dfdl:assert test="{. eq '----'}" />
                </xs:appinfo>
            </xs:annotation>
        </xs:element>
    </xs:sequence>
</xs:group>

Sadly, that produces this error:

[error] Schema Definition Error: occursCountKind='implicit' with unbounded 
maxOccurs only allowed for last element of a positional sequence

What is the correct way to express an array of arrays?

/Roger

Reply via email to