Hi Folks,

Consider this data format:

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

The first line (5) indicates the number of name lines that follow.

The first line can be specified using the integer datatype. See below.

The first line can also be specified using the string datatype. See below.

That is, both versions -- the integer version and the string version -- parse 
inputs identically.

My hypothesis is that every text data format that can be specified using 
specific datatypes (integer, date, float, etc.) can be specified using just the 
string datatype. Can you provide a counterexample to my hypothesis?  /Roger

DFDL Schema using the integer datatype:

<xs:element name="names">
    <xs:complexType>
        <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="infix">
            <xs:element name="number-of-names" type="xs:integer"  
                        dfdl:textNumberCheckPolicy="strict"  
                        dfdl:textStandardExponentRep="E" 
                        dfdl:textNumberRounding="pattern"
                        dfdl:textStandardZeroRep="0"
                        dfdl:textStandardBase="10"
                        dfdl:textNumberRep="standard"
                        dfdl:textNumberPattern="#" />
            <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:sequence>
    </xs:complexType>
</xs:element>

DFDL Schema using the string datatype:

<xs:element name="names">
    <xs:complexType>
        <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="infix">
            <xs:element name="number-of-names" 
                        dfdl:lengthKind="pattern"
                        dfdl:lengthPattern=".*">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:pattern value="[0-9]+"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="entry" maxOccurs="unbounded"
                        dfdl:occursCount="{ xs:integer(../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:sequence>
    </xs:complexType>
</xs:element>

Reply via email to