[x3d-public] JSON Encoding - Taking Don's idea one step further

John Carlson yottzumm at gmail.com
Sun Jan 3 15:54:06 PST 2016


The only thing I look at ‘-‘ for is to see if there’s something beyond it.  I have a special routine for handling anything inside a ‘-' section.  I don’t care what’s in the string after the ‘-‘.  I would like to see a ROUTE example with ROUTEs not at the end of a section.  A complete example with associated XML would be necessary to very roundtrip.


John
> On Dec 21, 2015, at 4:25 PM, John Carlson <yottzumm at gmail.com> wrote:
> 
> Actually, I don’t think that -children, -content etc matter to me, I will have to check to make sure.  What does matter is that I can stop moving ROUTEs to the end of a node.
>  
> Sent from Mail <http://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>  
> 
> From: Roy Walmsley <mailto:roy.walmsley at ntlworld.com>
> Sent: Monday, December 21, 2015 2:46 PM
> To: Don Brutzman <mailto:brutzman at nps.edu>; John Carlson <mailto:yottzumm at gmail.com>
> Cc: x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> Subject: JSON Encoding - Taking Don's idea one step further
>  
> Don and John,
>  
> I can see the benefit of Don’s idea. So, I have been trying to give it some thought, and would like to make the following very radical, iffy, suggestion:
>  
> Don’s idea was to introduce a “-children” to accommodate ROUTES and comments.
>  
> The current (or alternative) JSON encoding tends to treat it like a Classic VRML encoding, in the sense of specifying the xFNode field names and then adding the children.
>  
> My thought is, can we, say, add a “-content” field, and then add the content more in the XML encoding style. So comments and ROUTEs become content, just like child nodes. All nodes that have any children have a “-content”.
>  
> Take a snippet from the HelloWorld example. This is Don’s latest incarnation:
>  
>    { "Shape":
>       {
>         "-children":[
>           { "#comment":"Sphere begin"},
>           { "#comment":"Sphere complete, Appearance begin"},
>           { "#comment":"Appearance complete"}
>         ],
>         "-geometry":[
>           { "Sphere":
>             {
>             }
>           }
>         ],
>         "-appearance":[
>           { "Appearance":
>             {
>               "-children":[
>                { "#comment":"Material begin"},
>                { "#comment":"Material complete, ImageTexture begin"},
>                { "#comment":"ImageTexture complete"}
>               ],
>               "-material":[
>                 { "Material":
>                   {
>                     "@DEF":"MaterialLightBlue",
>                     "@diffuseColor":[0.1,0.5,1]
>                   }
>                 }
>               ],
>               "-texture":[
>                 { "ImageTexture":
>                   {
>                     "@DEF":"ImageCloudlessEarth",
>                     "@url":["earth-topo.png”]
>                   }
>                 }
>               ]
>             }
>           }
>         ]
>       }
>     }
>  
> And this is what my idea would produce:
>  
>    { "Shape":
>       {
>         "-content":[
>           { "#comment":"Sphere begin"},
>           { "Sphere":
>             {
>             }
>           }
>           { "#comment":"Sphere complete, Appearance begin"},
>           { "Appearance":
>             {
>               "-content":[
>                { "#comment":"Material begin"},
>                 { "Material":
>                   {
>                     "@DEF":"MaterialLightBlue",
>                     "@diffuseColor":[0.1,0.5,1]
>                   }
>                 }
>                { "#comment":"Material complete, ImageTexture begin"},
>                 { "ImageTexture":
>                   {
>                     "@DEF":"ImageCloudlessEarth",
>                     "@url":["earth-topo.png”]
>                   }
>                 }
>                { "#comment":"ImageTexture complete"}
>               ]
>             }
>           }
>           { "#comment":"Appearance complete"}
>         ]
>       }
>     }
>  
> I don’t know if it is valid JSON, but I hope it gives you the idea. @containerFields would be added if required.
>  
> Pros and cons:
>  
> PRO: All comments remain in exactly the right places (so would also apply to  ROUTEs)
> PRO: Uses the term “-content” which is not a term used elsewhere
>  
> CON: Would mean a complete rethink/rewrite of development tools.
>  
> Anyway, just an idea …
>  
> Regards,
>  
> Roy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160103/515d5319/attachment-0001.html>


More information about the x3d-public mailing list