[x3d-public] Validation improvements for "USE" attribute

Roy Walmsley roy.walmsley at ntlworld.com
Thu Jun 15 07:19:54 PDT 2017

Hi all,


Recently we updated the DTD/schemas to make the "name" field of nodes like
MetadataBoolean, or FloatVertexAttribute a required field. However, we then
realised that when any of these nodes has the "USE" attribute, the "name"
field must not be set. Hence the changes needed to be revisited.


I started to look at the JSON schema for the MetadataBoolean node, to try to
implement this stricter validation requirement. With some online assistance
I found that I could easily make either one or the other required, but not
both. This would meet the original requirement.


However, this raised a more general question in my mind. When any node has
the "USE" attribute set, what other fields/attributes are permitted?


As a test case, I concentrated on the MetadataBoolean node. I came up with a
JSON schema that might illustrate this better. I have attached a snapshot
image for this fragment of the JSON schema.


The validation of the MetadataBoolean node begins with a "one of" operator
(shown immediately to the right of the MetadataBoolean box. This operator
requires that one, and only one, of the two subschemas be valid. For the
first subschema (the upper of the two) I simply removed the "@USE" property,
making the "@name" field required (to meet the original requirement). For
the second subschema (the lower of the two) I made the "@USE" property
required, and only added the "IS" property. Note that both subschemas only
permit those properties listed (i.e. additional properties are disallowed).


In principle, there should be no difficulty applying this validation
methodology within the JSON schema to all nodes.


Some questions:

1.	Is this validation methodology correctly aligned with the standards?
2.	Do we want to apply this methodology to all nodes?
3.	Do we want to apply this methodology to other validation tools, e.g.
Schematron, and also consider whether the XML schema or the DTD have
sufficient expressive power too.


All comments appreciated,


All the best,



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170615/f6e4e6cc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Metadata boolean JSON schema candidate update.png
Type: image/png
Size: 30479 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170615/f6e4e6cc/attachment-0001.png>

More information about the x3d-public mailing list