[x3d-public] inconsistent typing of enumerations in X3D XML Schema

Don Brutzman brutzman at nps.edu
Sun Jun 19 13:53:12 PDT 2016


Hi Roy, found that we have inconsistent typing of enumerations in X3D XML Schema.  Sometimes xs:token is used, other times xs:string, other times SFString.

We would likely to well to use a single type, thereby avoiding problems with our various quality checkers, document generators and codebase generators that utilize the schema.  We should change all affected stylesheets along with the schema when we make the change.

Examples:
================
<xs:simpleType name="ArcClose2dTypeValues">
	<xs:annotation>
		<xs:appinfo>ArcClose2dTypeValues are allowed enumeration values for ArcClose2D closureType.</xs:appinfo>
		<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/geometry2D.html#ArcClose2D"/>
	</xs:annotation>
	<xs:restriction base="xs:token">
		<xs:enumeration value="PIE"/>
		<xs:enumeration value="CHORD"/>
	</xs:restriction>
</xs:simpleType>
================
<xs:simpleType name="fontFamilyValues">
	<xs:annotation>
		<xs:appinfo>fontFamilyValues are allowed enumeration values for FontStyle/ScreenFontStyle node family attribute.</xs:appinfo>
		<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/text.html#Fontfamilyandstyle"/>
	</xs:annotation>
	<xs:restriction base="xs:string">
		<xs:enumeration value="SANS"/>
		<xs:enumeration value="SERIF"/>
		<xs:enumeration value="TYPEWRITER"/>
		<xs:enumeration value="...">
			<xs:annotation>
				<xs:appinfo> unbounded, additional values are possible </xs:appinfo>
			</xs:annotation>
		</xs:enumeration>
	</xs:restriction>
</xs:simpleType>
================
<xs:attribute name="matchCriterion" default="MATCH_ANY">
	<xs:simpleType>
		<xs:restriction base="SFString">
			<xs:enumeration value="MATCH_ANY"/>
			<xs:enumeration value="MATCH_EVERY"/>
			<xs:enumeration value="MATCH_ONLY_ONE"/>
		</xs:restriction>
	</xs:simpleType>
</xs:attribute>
================

XML Schema references:

3 Built-in Datatypes and Their Definitions (figure attached)
https://www.w3.org/TR/xmlschema11-2/#built-in-datatypes

3.3.1 string
https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#string

3.4.2 token
https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/datatypes.html#token

> [Definition:]   token represents tokenized strings. The ·value space· of token is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. [...] The ·base type· of token is normalizedString.

Of the three types used, xs:token is strictest and also closest conceptually to an enumeration type.  So that would likely be the best choice.

Suggested resolution: briefly review comments (if any) during a teleconference, then apply change when agreed upon.

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: https://www.w3.org/TR/xmlschema11-2/type-hierarchy-201104.png
Type: image/png
Size: 113084 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160619/2ede1953/attachment-0001.png>


More information about the x3d-public mailing list