[x3d-public] validation problem: cannot require name attribute on a USE node

Roy Walmsley roy.walmsley at ntlworld.com
Mon May 29 10:39:39 PDT 2017


Hi,

Now this is an interesting one. Agreed that @name and @use can't both be present as indicated by Don. So JSON schema needs an update. Yes, it does have sufficient expressive power to meet this requirement. I could change both metadata nodes (all six) and vertex attribute nodes (all three). Will have to wait until after the conference, though.

All the best,

Roy

-----Original Message-----
From: Don Brutzman [mailto:brutzman at nps.edu] 
Sent: 29 May 2017 15:27
To: Roy Walmsley <roy.walmsley at ntlworld.com>
Cc: X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: validation problem: cannot require name attribute on a USE node

Trouble report for X3D JSON Schema, XML DTD and XML Schema.  If @USE is present, @name attribute should not appear because that is given in the original DEF node.  That avoids mismatch problems.

In X3D XML DTD and X3D XML Schema, we recently required the @name field.  However, this change overlooked the USE problem.  X3DMetadataNode and MetadataSet need to change back in this regard.  Looks like VertexAttribute nodes also.

(We do have one variation to this approach: ProtoInstance requires @name even if @USE, because node name is really needed for nearly all other checks and operations.)

Wondering, shouldn't *VertexAtttribute names be NMTOKEN?  Seems to strict for general metadata perhaps, but seems logical for shaders.

http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamples.x3d

<MetadataSet DEF='NestedMetadataSetNode' name='TestNestedMetadataSetNodes'>
   <MetadataString USE='MyMetadataStringNode' containerField='value'/>
   <MetadataInteger USE='MyMetadataIntegerNode' containerField='value'/>
   <MetadataFloat USE='MyMetadataFloatNode' containerField='value'/>
   <MetadataFloat containerField='value' name='coefficients' value='3.141592653 2.7128 1 0'/> </MetadataSet>

===========================
X3D Schema update activity:

23 April 2017 brutzman walmsley puk
- name attribute required for Metadata* and *VertexAttribute (v3.1+) nodes ===========================

Similarly, the above block is correctly converted by X3dToJson.xslt as

"-metadata":
   { "MetadataSet":
	{
	  "@name":"TestNestedMetadataSetNodes",
	  "@DEF":"NestedMetadataSetNode",
	  "-value":[
		{ "MetadataString":
		  {
			"@USE":"MyMetadataStringNode"
		  }
		},
		{ "MetadataInteger":
		  {
			"@USE":"MyMetadataIntegerNode"
		  }
		},
		{ "MetadataFloat":
		  {
			"@USE":"MyMetadataFloatNode"
		  }
		},
		{ "MetadataFloat":
		  {
			"@name":"coefficients",
			"@value":[3.141592653,2.7128,1,0]
		  }
		}
	  ]
	}
   }

however the JSON scema is incorrectly reporting a problem with missing @name attribute:

C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter15Metadata//MetadataNodeExamples.x3d processing with X3dToJson stylesheet C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter15Metadata//MetadataNodeExamples.json validation checking with jslint C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter15Metadata//MetadataNodeExamples.json validation checking with json-schema-validator
--- BEGIN C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\Chapter15Metadata\MetadataNodeExamples.json---
validation: FAILURE
[ {
   "level" : "error",
   "schema" : {
     "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",
     "pointer" : "/definitions/MetadataString"
   },
   "instance" : {
     "pointer" : "/X3D/Scene/-children/2/WorldInfo/-metadata/MetadataSet/-metadata/MetadataSet/-value/0/MetadataString"
   },
   "domain" : "validation",
   "keyword" : "required",
   "message" : "object has missing required properties ([\"@name\"])",
   "required" : [ "@name" ],
   "missing" : [ "@name" ]
}, {
   "level" : "error",
   "schema" : {
     "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",
     "pointer" : "/definitions/MetadataInteger"
   },
   "instance" : {
     "pointer" : "/X3D/Scene/-children/2/WorldInfo/-metadata/MetadataSet/-metadata/MetadataSet/-value/1/MetadataInteger"
   },
   "domain" : "validation",
   "keyword" : "required",
   "message" : "object has missing required properties ([\"@name\"])",
   "required" : [ "@name" ],
   "missing" : [ "@name" ]
}, {
   "level" : "error",
   "schema" : {
     "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",
     "pointer" : "/definitions/MetadataFloat"
   },
   "instance" : {
     "pointer" : "/X3D/Scene/-children/2/WorldInfo/-metadata/MetadataSet/-metadata/MetadataSet/-value/2/MetadataFloat"
   },
   "domain" : "validation",
   "keyword" : "required",
   "message" : "object has missing required properties ([\"@name\"])",
   "required" : [ "@name" ],
   "missing" : [ "@name" ]
} ]
--- END C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\Chapter15Metadata\MetadataNodeExamples.json---

Am wondering if JSON Schema has sufficient expressive power for this.

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