Hi Folks,

I just learned this from Mike.

Which of these is better:

    <xs:element name="Countries">
        <xs:simpleType>
            <xs:restriction base="validString">
                <xs:enumeration value="Afghanistan"/>
                <xs:enumeration value="Albania"/>
                <xs:enumeration value="Algeria"/>
                ...
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="Countries">
        <xs:simpleType>
            <xs:restriction base="validString">
                <xs:pattern value="Afghanistan|Albania|Algeria|..."/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

Answer: the first one. Mike explains:

"for large enums (dozens of entries), the enums broken out will be faster than 
the regex. Daffodil uses a hash table for the large enums. The regex engine is 
unlikely to be that sophisticated."


Reply via email to