[x3d-public] JSONParser, ProtoExpander in X3DOM repository code

John Carlson yottzumm at gmail.com
Thu May 24 13:26:15 PDT 2018


The JSON Parser (JSON -> DOM) aka JSON Loader and ProtoExpander is now found in X3DOM repository source code under src/util/json .  You may specify X3D JSON files on URLs, and X3DOM will attempt to load as X3D JSON before loading as XML.

Note that the ProtoExpander currently has a bug that brings field @value’s up to the next level as @(the name of the field), if they are used in IS.  Regular attributes should work fine.  So test your PROTOs, but don’t rely on X3DOM yet for PROTOs (X_ITE has JSON PROTOs).   Besides, the ProtoExpander is kind of a hack in lieu of actual PROTOs. The ProtoExpander expands DEFs, USEs, and ProtoBodies to several instances.

This is a good way to start getting used to X3D JSON in the context of X3DOM.  Merely specify a JSON URL, and away you go!

Here is a simple example:

    <X3D width='400px' height='400px' showStats="true" showLog="true">
        <Scene>
                <Inline url="../data/SimpleShader.json"></Inline>
        </Scene>
    </X3D>

X3DJSONLD can continue to serve your X3D JSON development needs, but will likely be under quicker changes than X3DOM.  I hope to bring more features into X3DOM perhaps, such as SAI JS object loading, etc.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180524/392beffb/attachment.html>


More information about the x3d-public mailing list