[x3d-public] X3D Object Model and X3D XML Schema attributeGroup definitions for DEF, USE, class

Don Brutzman brutzman at nps.edu
Wed Oct 26 13:00:00 PDT 2016


While using the X3D Object Model to autogenerate Java SAI Library, noticed some interesting omissions.

1. First, XML Schema has the following attributeGroup definitions for DEF, USE, class

	http://www.web3d.org/specifications/x3d-3.3.xsd
	<!--======================================================================-->
	<!--Attribute groups-->
	<!--DEF and USE are node-naming attributes common to all instantiable nodes. This attributeGroup is defined for all top-level node types in the node interface hierarchy.-->
	<xs:attributeGroup name="DEF_USE">
		<xs:annotation>
			<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics"/>
		</xs:annotation>
		<xs:attribute name="DEF" type="xs:ID">
			<xs:annotation>
				<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics"/>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="USE" type="xs:IDREF">
			<xs:annotation>
				<xs:documentation source="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics"/>
			</xs:annotation>
		</xs:attribute>
	</xs:attributeGroup>
	<xs:attributeGroup name="globalAttributes">
		<xs:attribute name="class" type="xs:NMTOKENS">
			<xs:annotation>
				<xs:appinfo>
					The class attribute is a space-separated list of classes, reserved for use by XML stylesheets.
				</xs:appinfo>
				<xs:documentation source="http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#ClassAttributeSyntax"/>
			</xs:annotation>
		</xs:attribute>
	</xs:attributeGroup>
	<!--======================================================================-->


2. Second, these groups are referenced in X3DNode, X3DNodeMixedContent, ProtoInstance, MetadataSet, X3DProgrammableShaderObject, X3DScriptNode, ComposedShader.

- X3DNode, X3DNodeMixedContent are expected, they are topmost (mixed content refers to contained CDATA plain-text scripts).
- ProtoInstance is a special wild-card node that requires special handling in the node hierarchy.
- MetadataSet had some complications that we sorted out in this fashion, I believe 2 Mantis issues pertain to these.
	http://www.web3d.org/member-only/mantis/view.php?id=848
	http://www.web3d.org/member-only/mantis/view.php?id=834
- I think X3DProgrammableShaderObject, X3DScriptNode, ComposedShader relate to mixed content and special schema arrangements, for example:
	<!-- ComposedShader does not derive from X3DNode because of the need to have field children come first, before IS and ChildContentModelCore. -->

In short, all of these functionally derive from X3DNode, and any variations in the Schema are solely due to schema strictness (usually relating to avoidance of nondeterministic content models among the various cross-referencing inheritances).

Supporting reference for object model is abstract spec, 4.4.2.3 Interface hierarchy
http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#InterfaceHierarchy

Related reference is X3D XML Schema Documentation
http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3.html

Repeating key point: all three of these attributes functionally derive from X3DNode.


3.  In any case, these common attributes need to be listed in the X3D object model.

a. Am thinking that most consistent approach might simply be adding them to all nodes, e.g.

	<field type="SFString" accessType="" name="DEF"   default="" inheritedFrom="X3DNode"/>
	<field type="SFString" accessType="" name="USE"   default="" inheritedFrom="X3DNode"/>
	<field type="SFString" accessType="" name="class" default="" inheritedFrom="X3DNode"/>

b. Alternatively we might use type="NMTOKEN" for DEF/USE, and similarly use that definition elsewhere (e.g. name="name" attributes).

c. Something else?

All feedback welcome.  Thanks for considering this representation issue.

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