More thoughts on XML Schema Datatypes (lexical representation)

It seems like trying to determine the nature of the lexical element from the
datatype (or its base datatype) is troublesome.  Wouldn't it be better to
have the lexical element contain child element of specific types.   (I know
that the presence of regex is debatable, it's inclusion here is not an
opinion on that debate)

Say something like

<datatype name="postalcode" basetype="string">
	<lexicalRepresentation>
		<regex>some regular expression</regex>
	</lexicalRepresentation>
</datatype>

<datatype name="F6.2" basetype="real">
	<!--  lexical rep allows any string that passes one of the inclosed
lexical tests  -->
	<lexicalRepresentation>
		<!--    to match this lexical form then it must pass all
tests -->
		<lexical>
			<regex>[0-9+-][0-9][0-9]\.[0-9][0-9]</regex>
			<numeric digitGroupSymbol="," digitGroupEvery="0"
decimalSepSymbol="."/>
		</lexical>
	</lexicalRepresentation>
<datatype>

<datatype name="mydate" basetype="date">
	<lexicalRepresentation>
		<!-- this would allow the 12/25/1999 format described in the
document  
			(though wouldn't fail on a 15th month or a 35th day)
-->
		<regex>[0-1][0-9]/[0-3][0-9]/[0-9][0-9][0-9][0-9]</regex>
		<!--  I made this an attribute so that the DTD could
validate it as an enumeration  -->
		<dateLexical Form="YY-MM-DD" Separators=" /-" />
	</lexicalRepresentation>
</datatype>

Received on Friday, 25 June 1999 12:39:01 UTC