[x3d-public] Fw: ProtoInstance USE without name

Andreas Plesch andreasplesch at gmail.com
Mon Nov 30 19:47:43 PST 2020


---on the phone---

On Mon, Nov 30, 2020, 10:17 PM Don Brutzman <brutzman at nps.edu> wrote:

> 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...
>

ProtoInstance by itself is meaningless. Protoinstance together with a name
does instantiate a x3d node.


> 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.
>

On the contrary, a concept of strictness may require to have a name
attribute with USE to allow for redundancy in validation, in the same way
regular X3D USE nodes need to match their DEF type.


> 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...
>

ok. I can test again.


> 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!
>

Actually, in this case it is the source of a workaround, an accidental
solution to a problem.

all the best, Andreas


> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20201130/974fa1ae/attachment.html>


More information about the x3d-public mailing list