[x3d-public] Improvements to the unofficial *X3D* JSON loader

John Carlson yottzumm at gmail.com
Mon Nov 16 08:48:38 PST 2015


Further enhancements include the ability to load X3D files and images based on the URL of the JSON file.   There’s a bit of confusion on the @url attributes MFString right now, so I have coded it for what’s currently in the JSON files in the X3D Resources examples, A single long string within an array.

John
> On Nov 13, 2015, at 4:23 PM, John Carlson <yottzumm at gmail.com> wrote:
> 
> I have added improvements to my unofficial X3D JSON to X3DOM loader.  Please test against your X3D JSON scenes.
> 
> Loader (and license) is at:
> 
> https://github.com/coderextreme/X3DJSONLD <https://github.com/coderextreme/X3DJSONLD>
> 
> 
> You can do:
> 
> $ git clone https://github.com/coderextreme/X3DJSONLD <https://github.com/coderextreme/X3DJSONLD>
> 
> then
> 
> $ cd X3DJSONLD
> $ unzip http://www.web3d.org/x3d/content/examples/X3dExampleArchivesJsonScenes.zip <http://www.web3d.org/x3d/content/examples/X3dExampleArchivesJsonScenes.zip>
> or actually something like:
> $ unzip ~/Downloads/X3dExampleArchivesJsonScenes.zip
> $ ln -s www.web3d.org/x3d/content/examples/ <http://www.web3d.org/x3d/content/examples/> 
> $ python -m SimpleHTTPServer
> 
> You should be able to go to http://localhost:8000 <http://localhost:8000/> to see the loader in action.  I have moved several large scenes to the top of the select list.
> 
> Alternatively, instead of running python, you can run node.js, available from https://nodejs.org/ <https://nodejs.org/>
> 
> Change config.js to point to you examples folder.
> 
> $ npm install
> $ node app.js
> 
> Then go to http://localhost:3000 <http://localhost:3000/> to see the loader in action.
> 
> Alternatively, change the name of X3DJSONLD/index.html to X3DJSONLD.html, then copy X3DJSONLD.html, flipper.json and X3DJSONLD.js to www.web3d.org/x3d/content/ <http://www.web3d.org/x3d/content/> (beware of overwrites) and go to web server at http://www.web3d.org/x3d/content/X3DJSONLD.html <http://www.web3d.org/x3d/content/X3DJSONLD.html> (Don, you can try this).  I will probably make the index.html name change permanent at some point, but I need Don to tell me a good name that is available for me to use under x3d/content/ (or exactly where he wants to put the loader, if anywhere).
> 
> If someone wants to add a typeahead search pane for the select list, please do.  Forks and pull requests are welcome.
> 
> 
> I view this code as fairly simple to review and not a large security risk, as long as you insure that the JSON you load does not contain security holes.  That is, watch out for embedded script tags and other nasties.  No attempt to validate the JSON is made at this point, so my loader will load ANY DOM found in the JSON, including SVG, HTML, etc.  About the only thing to watch out for is the @, - and # prefixes.  If you do want to load SVG or HTML JSON, you will need to make sure your JSON has those prefixes.
> 
> John
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20151116/57ccf7d5/attachment.html>


More information about the x3d-public mailing list