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

Roy Walmsley roy.walmsley at ntlworld.com
Sun Jun 19 16:24:48 PDT 2016


Hi Don,

I fully agree with being consistent.

With respect to which of the three, I see two arguments:

1) SFString isn't really what it is, because it is not a field, it is a string value. So not this.
2) xs:string or xs:token? The question is do we have now, or foresee having in the future, having an enumeration that would fail the xs:token validation? If the answer is yes, then that implies we should choose xs:string.
3) If the answer to 2) is no, then we can choose either. xs:string would harmonize with JSON string. Other than that I have no particular preference. I would be happy to go with xs:token if you prefer it.

Regards,

Roy



-----Original Message-----
From: Don Brutzman [mailto:brutzman at nps.edu] 
Sent: 19 June 2016 21:53
To: Roy Walmsley
Cc: X3D Graphics public mailing list
Subject: inconsistent typing of enumerations in X3D XML Schema

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




More information about the x3d-public mailing list