[x3d-public] Fw: ProtoInstance USE without name

Don Brutzman brutzman at nps.edu
Mon Nov 30 19:16:54 PST 2020


Thank you very much for error reports.

On 11/29/2020 1:27 PM, Andreas Plesch wrote:
> 
> Validator complaints:
> 
> A: PigCompliant.x3d
> 
> 7. Schematron check
> 
> <ProtoInstance DEF="" USE="ThePig" name="Pig"/> includes unnecessary attribute name='Pig' which is not permitted for ProtoInstance USE node [/X3D/Scene/Transform/ProtoInstance, error]
> 
> Well, the name attribute actually is permitted, at least in the spec., since ProtoInstance is not a x3d node by itself. Not sure why the validator claims it is not permitted. In addition, I think name should be allowed ( ideally required but not possible due to backward compatibility ).

Hmmm.  Well since ProtoInstance acts like a node instance, I do treat it as such...

A statement like "having a name is optional" makes little sense, and even if not incorrect at the moment, change can easily lead to an error if any of the 4 DEF, USE or name values change, so the validator (X3D Schematron) doesn't allow it.

Strictness is good.  Also follows an important design principle:

* Wikipedia:  Don't repeat yourself (DRY)
   https://en.wikipedia.org/wiki/Don't_repeat_yourself

> B: PigNoName.x3d
> 
> 7. Schematron check
> 
> <Sound DEF=''/> minBack='40' maxBack='100' has minBack value greater than maxBack value [/X3D/Scene/ProtoDeclare/ProtoBody/Group/Sound, error] <Sound DEF=''/> minFront='40' maxFront='100' has minFront value greater than maxFront value [/X3D/Scene/ProtoDeclare/ProtoBody/Group/Sound, error]
> 
> misfire of Validator, since 40 is not greater than 100. Perhaps alphabetical comparison rather than numerical in stylesheet.

I suspect you are correct, since checking the existing logic looks OK.

Now coercing XSLT typing of min/max front/back values to number(@minFront) before comparing...

Unit testing of TestSchematronDiagnostics.x3d cases all work so we should be OK now, update will deploy sometime.

> C: PigWorkaround.x3d
> 
> <Script USE='ThePig'/> node type must match node type of original <ProtoInstance DEF='ThePig'/> [/X3D/Scene/Transform/Script, error]
> 
>   Yes, pretty obvious but still accepted by quite a few browsers.

Well obvious to scrupulous scrutinizing authors maybe but a really mysterious maddening source of error otherwise!

Glad it worked.  8)

[...]

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