[X3D-Public] DEF/USE naming restrictions
brutzman at nps.edu
Thu Aug 25 17:36:22 PDT 2011
I received an interesting question about DEF/USE naming restrictions,
and which characters are allowed as the beginning of a DEF name.
Upon investigation it looks like the answer is "it depends" on the
In order to pass XML validation of the .x3d encoding, it must
begin with a letter or _ underscore character.
the rules for the VRML and ClassicVRML encoding are part of the
Grammar section at
Grammar excerpts follow:
IdFirstChar IdRestChars ;
Any ISO-10646 character encoded using UTF-8 except: 0x30-0x3a, 0x0-0x20, 0x22, 0x23, 0x27, 0x2b, 0x2c, 0x2d, 0x2e, 0x5b, 0x5c, 0x5d, 0x7b, 0x7d, 0x7f ;
and so the most restrictive answer is to not start with a number
or else interoperability between encodings isn't possible. this is
also important if someone is using IMPORT or EXPORT to allow routing
of events into (or out of) and Inlined X3D scene.
I have added the following synopsis to the X3D Scene Authoring Hints:
There are multiple requirements for characters allowed in DEF/USE names.
.x3d, .x3db encodings: must follow _XML requirements_ for ID/IDREF data type.
.x3dv, .wrl encodings: must follow _ClassicVRML Grammar requirements_ for Id/IdFirstChar.
Most restrictive and most interoperable: can start with letter or underscore character, but not a number or a colon. Can then include letters, numbers, hyphen, underscore, or period characters. This interoperability is important so that files can be converted equivalently between encodings without validation problems.
Discussion comments or improvements welcome.
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, virtual worlds, underwater robots http://faculty.nps.edu/brutzman
More information about the X3D-Public