Hello DFDL community,

The following input file can be parsed in one pass:

5
Name: Tom
Name: Bill
Name: Jill
Name: Sara
Name: Bob

where 5 indicates the number of names that follow. I know a 1-pass parse is 
possible because I wrote a DFDL schema to do it.

Question #1: Do you agree that the following input file cannot be parsed in one 
pass; it requires two passes?

Name: Tom
Name: Bill
Name: Jill
Name: Sara
Name: Bob
5

Three more questions:

Question #2: An expression in a DFDL attribute can only look backward; an 
expression cannot look forward. Do you agree?

Question #3: The expression in the following dfdl:occursCount is trying to look 
forward; do you agree?

<xs:element name="names">
    <xs:complexType>
        <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="infix">
            <xs:element name="entry" maxOccurs="unbounded" 
                dfdl:occursCount="{ ../number-of-names }" 
dfdl:occursCountKind="expression">
                <xs:complexType>
                    <xs:sequence dfdl:separator=":" 
dfdl:separatorPosition="infix">
                        <xs:element name="name" type="xs:string" />
                        <xs:element name="value" type="xs:string" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="number-of-names" type="xs:integer" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

Question #4: My example of a text format that requires 2 passes is hokey (why 
would anyone put the number after the list of names). Can you think of a more 
realistic example of a text format that requires 2 passes?

/Roger

Reply via email to