[x3d-public] Simplifying ProtoInstance nodes

John Carlson yottzumm at gmail.com
Sat May 10 20:13:52 PDT 2025


I’m not seeing any obvious JavaScript XSD DOM validators?

Sure, lots of string validation, but I have DOM in JavaScript, converted
from JSON.

Such a thing does not exist or is an ActiveX thingy or something?

I’ll try AI next.

John

On Sat, May 10, 2025 at 9:58 PM John Carlson <yottzumm at gmail.com> wrote:

> In X3DJSONLD.js,  i can add short-form expansion in CreateElement(),
> essentially creating ProtoInstance elements from *ProtoDeclare recognized
> elements.  Perhaps I can capture undefined elements from Ajv schema
> validation instead of validating the unmodified JSON.  So I’m hoping there
> a validation hook for undefined elements.  Maybe check your XML validators
> as well.
>
> CreateElement code:
>
>
> https://github.com/coderextreme/X3DJSONLD/blob/bd5c620a44997d300e1a751fd9f873deaf9fe403/src/main/node/X3DJSONLD.js#L302
>
>
> Ultimately, you probably want to validate the modified long-form DOM
> before translating to many bindings using the rest of X3DJSONLD.  But only
> if you know you have short-form in the original code.
>
> So, in CreateElement, I will store ProtoDeclare/ProtoInterface and
> ExternProtoDeclare names and field names and default values.  When I expand
> the short form, I will validate short-form names and values against
> ProtoInterface fields and types.
>
> This all leads towards DOM validation in X3DJSONLD.js, so perhaps I’ll bag
> JSON schema altogether.
>
> If someone knows XML validation tools in JavaScript, clue me in!
>
> When that’s done, I’ll work on x3dschema:
>
> CreateElement in Java:
>
>
> https://github.com/coderextreme/x3dschema/blob/269135736fdbe61e8b21c48fe17fbeaa8a7f93c1/X3DJSONLD.java#L73
>
> Ditto, but this time, no need to validate with Ajv.
>
> John
>
> On Sat, May 10, 2025 at 9:16 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> I’ll work on a ProtoInstance short-form to long-form in X3DJSONLD, then
>> test ajv JSON schema validation.
>>
>> I’ll come up with something for JSON.  Someone else should do XML.   I
>> will probably put the JSON expansion in X3DJSONLD.java (my x3dschema
>> repository), so JSON can be validated with Java and XML schema easily.
>> I’m guessing something similar can be done for X3DLoaderDOM.java with a bit
>> more work for X3DJSAIL.  I probably won’t do stylesheet code for X3DJSAIL.
>>
>> Maybe in the next few days.
>>
>> The nice thing about XML is that you can construct DOM that doesn’t pass
>> schema, change the DOM, then validate it.
>>
>> Whoever wants to do SAX or StAX, be my guest!
>>
>> John
>>
>> On Sat, May 10, 2025 at 8:27 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> Validate short-form Protos in X3D by converting short form to
>>> ProtoInstance form when loading.
>>> No new schema necessary.
>>>
>>> John
>>>
>>> On Sat, May 10, 2025 at 11:38 AM Brutzman, Donald (Don) (CIV) via
>>> x3d-public <x3d-public at web3d.org> wrote:
>>>
>>>> Thanks for the interesting, innovative discussion.  Excerpting the
>>>> example:
>>>>
>>>>
>>>>    -
>>>>    https://create3000.github.io/x_ite/tutorials/creating-new-node-types/#using-prototyped-nodes
>>>>
>>>>
>>>> _________________________
>>>> XML Encoding
>>>>
>>>> 1
>>>> 2
>>>> 3
>>>> 4
>>>> 5
>>>> 6
>>>> 7
>>>> 8
>>>> 9
>>>>
>>>> <!--* Official Syntax *-->
>>>> <ProtoInstance name='BouncingBall'>
>>>>   <fieldValue name='cycleInterval' value='2'/>
>>>>   <fieldValue name='bounceHeight' value='3'/>
>>>> </ProtoInstance>
>>>> <!-- *Short Syntax *-->
>>>> <BouncingBall
>>>>     cycleInterval='2'
>>>>     bounceHeight='3'/>
>>>>
>>>> Classic VRML Encoding
>>>>
>>>> 1
>>>> 2
>>>> 3
>>>> 4
>>>>
>>>> BouncingBall {
>>>>   cycleInterval 2.0
>>>>   bounceHeight  3.0
>>>> }
>>>>
>>>> _________________________
>>>>
>>>> One drawback with the "short" XML syntax is that it will not pass XML
>>>> DOCTYPE or XML Schema validation, although it still must conform to XML
>>>> well-formed rules.  Additional tool-specific capabilities can check for
>>>> such correctness during parsing, of course.  Avoiding XML validation
>>>> relaxes quality assurance (QA)  for the entire scene, not just that
>>>> prototype instance, and so use of the short form should be considered
>>>> carefully.
>>>>
>>>> Of course there is much merit too, not least of which are readability
>>>> and consistency with other XML-encoded nodes.
>>>>
>>>> As it turns out, now is a good time to consider such a change to the
>>>> X3D Standards suite.  We have highly mature documents defining X3D
>>>> encodings using XML and ClassicVRML syntax.  Conceivably a "short" form for
>>>> ProtoInstance will carry over satisfactorily for JSON and other encodings
>>>> as well, when we get to them this fall.
>>>>
>>>> If X_ITE and X3DOM already handle this form, and if Castle Model Viewer
>>>> (Castle Game Engine) is also supportive, I'm not yet seeing any blockers to
>>>> adoption.  Further implementation and evaluation of course will be useful
>>>>
>>>> Reference and specific clause that would need modification:
>>>>
>>>>
>>>>    - *X3D XML Encoding 4.0
>>>>    <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-1v4.0-WD1/Part01/X3D_XML.html>*
>>>>     revision 19776-1
>>>>    - 4.3.3.2  ProtoInstance node and fieldValue statement syntax
>>>>    -
>>>>    https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-1v4.0-WD1/Part01/concepts.html#ProtoInstanceAndFieldValueStatement
>>>>
>>>>
>>>> Probably no changes needed:
>>>>
>>>>
>>>>    - *X3D Classic VRML Encoding 4.0
>>>>    <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-2v4.0-WD1/Part02/X3D_ClassicVRML.html>*
>>>>     revision 19776-2
>>>>    - 4.3.3.2 Prototype instances and field value initialization syntax
>>>>    -
>>>>    https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-2v4.0-WD1/Part02/concepts.html#ProtoInstanceAndFieldValueStatement
>>>>
>>>>    - *X3D Architecture 4.1
>>>>    <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/Architecture.html>*,
>>>>    revision 19775-1
>>>>    - 4.4.4 Prototype semantics
>>>>    -
>>>>    https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/concepts.html#PrototypeSemantics
>>>>
>>>>
>>>> Thanks for careful consideration of this potential capability.  All
>>>> feedback welcome.
>>>>
>>>> Have fun with X3D extensibility!  🙂
>>>>
>>>> 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
>>>> https://faculty.nps.edu/brutzman
>>>>
>>>>
>>>>
>>>> ------------------------------
>>>> *From:* x3d-public on behalf of Holger Seelig via x3d-public
>>>> *Sent:* Saturday, May 10, 2025 1:13 AM
>>>> *To:* X3D
>>>> *Cc:* Holger Seelig
>>>> *Subject:* Re: [x3d-public] Simplifying ProtoInstance nodes
>>>>
>>>> This is already possible if you use the „short syntax“ of a proto
>>>> instance:
>>>>
>>>>
>>>> https://create3000.github.io/x_ite/tutorials/creating-new-node-types/#using-prototyped-nodes
>>>>
>>>> You can use this in X_ITE, but also in X3DOM.
>>>>
>>>> Best regards,
>>>> Holger
>>>>
>>>> --
>>>> Holger Seelig
>>>> Leipzig, Germany
>>>>
>>>> holger.seelig at yahoo.de
>>>> https://create3000.github.io/x_ite/
>>>> https://patreon.com/X_ITE
>>>>
>>>>
>>>>
>>>> Am 10.05.2025 um 05:55 schrieb John Carlson via x3d-public <
>>>> x3d-public at web3d.org>:
>>>>
>>>> My thought is to replace “ProtoInstance” tags with “MenuItem” tags, and
>>>> fieldValue statements with attributes, but I’ve not done that before. My
>>>> goal is to make the model more accessible to screen readers.
>>>>
>>>> Any examples are welcome.
>>>>
>>>> See attached link and model.
>>>>
>>>> John
>>>>
>>>> ---------- Forwarded message ---------
>>>> From: *John Carlson* <yottzumm at gmail.com>
>>>> Date: Thu, Mar 6, 2025 at 4:35 PM
>>>> Subject: Latest cleaned Jin FACS (needs metadata)
>>>> To: Don Brutzman <brutzman at nps.edu>, Joe D Williams <
>>>> joedwil at earthlink.net>
>>>>
>>>>
>>>> Attached.
>>>>
>>>> And:
>>>>
>>>> https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/coderextreme/ci2had/refs/heads/main/resources/CleanedYouClocks.x3d
>>>>
>>>> John
>>>> <CleanedYouClocks.x3d>_______________________________________________
>>>> x3d-public mailing list
>>>> x3d-public at web3d.org
>>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>>>
>>>>
>>>> _______________________________________________
>>>> x3d-public mailing list
>>>> x3d-public at web3d.org
>>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250510/4d1ca83f/attachment-0001.html>


More information about the x3d-public mailing list