[x3d-public] X3D typing of name attributes

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Sun Jan 27 17:35:35 PST 2019


While working on X3D v4 XML Schema, noticed some inconsistencies in typing of name attributes that needed to be addressed for consistent validation.

Writeup online in X3dSceneAuthoringHints - Naming Conventions - NameTyping
================================================================================
http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#NameTyping

Typing of name attributes:

Small variations in SFString types for name attributes can occur in order to best achieve strict validation of content.

* type="SFString" (meaning no restrictions) is applied to name attribute for meta statement, matching HTML.

* type="xs:token" (meaning that normalized embedded space characters are allowed) is applied to name attribute for Core component X3DMetadataObject Metadata nodes, and also applied to CADGeometry component X3DProductStructureChildNode CAD nodes. This provides wider latitude when matching terminology structures from other metadata nomenclatures.

* type="NMTOKEN" (meaning that no whitespace characters are allowed) is applied to name attribute for Humanoid Animation (HAnim) nodes, component and unit statements, simpleType SFString enumeration names, and prototype definitions (ProtoDeclare, ExternProtoDeclare, ProtoInstance, field and fieldValue).

* type="NMTOKEN" (meaning that no whitespace characters are allowed) is applied to name attribute for X3DVertexAttributeNode nodes (FloatVertexAttribute, Matrix3VertexAttribute, Matrix4VertexAttribute) that define Shader interface data structures. This provides maximum strictness supporting a variety of shader programming languages which typically do not support whitespace in names.
================================================================================

The first one listed above (for meta element, i.e. META statement) is debatable: we might want to go stricter.  However staying lax like HTML isn't so bad if it helps naive content get started without blockers.

If NMTOKEN is somehow incompatible with any of the shader languages, which might demand embedded whitespace in VertexAttribute array names, please advise.

Also added/improved entries under X3D Resources: type Definitions
================================================================================
http://www.web3d.org/x3d/tooltips/X3dTooltips.html#type

* NMTOKEN is an XML term for Name Token. NMTOKEN is a special kind of CDATA string that must match naming requirements for legal characters, with no whitespace characters allowed. Additionally, from XML specification: disallowed initial characters for Names include numeric digits, diacritics (letter with accent or marking), the "." period character (sometimes called full stop) and the "-" hyphen character. For further information see X3D Scene Authoring Hints: Naming Conventions.

* xs:token is similar to NMTOKEN string but allows multiple single-occurrence whitespace characters within the string. No leading, trailing or multiple-adjacent whitespace characters can occur. Example: "A Special Name".
================================================================================

Strict but compatible naming is very important for
- validation of correct content,
- compatibility with other metadata standards,
- X3D Scene Access Interface (SAI) implementations in various programming languages,
- X3D Unified Object Model (X3DUOM) typing, and
- X3D Semantic Web ontology generation.

I think the above guidelines get the job done.  They have been implemented in X3D XML Schema, X3DUOM and X3DJSAIL.  Regression testing in progress on X3D Examples Archives.  They should have no impact on valid existing content.

	X3D Specifications: Schema and DOCTYPE Validation
	X3D v4 XML Schema Documentation
	http://www.web3d.org/specifications/X3dSchemaDocumentation4.0/x3d-4.0.html

	X3D Unified Object Model (X3DUOM)
	http://www.web3d.org/specifications/X3DUOM.html

	X3DJSAIL: X3D Java Scene Access Interface Library
	http://www.web3d.org/specifications/java/X3DJSAIL.html
	
All review, comments and improvements are welcome.  Thanks in advance for any time spent on this small but fundamental detail.

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