X3D JSON loader and node.js express web server for serving files from localhost
for using the API, read doc/GettingStarted.pdf There are still symbols in the global scope I'd like to get rid of. If you'd like to help, fork and issue a pull request.
Download and install git
git clone https://github.com/coderextreme/X3DJSONLD cd X3DJSONLD
If you want to use node.js as your web server, download and install node.js (npm comes with it). You can download examples from here: http://www.web3d.org/x3d/content/examples/X3dExampleArchivesJsonScenes.zip
Edit src/main/node/config.js for node.js, put maven in your path, install X3DJSAIL in your maven repository per the pom.xml (it's different than the X3DJSAIL distribution) and start a web server
npm install node app.js
In particular, I am choosing tags, attribute names, and attributes right out of the JSON and XML with limited filtering or checking (just checking JSON schema, which may be ignored). You should validate any JSON or XML being loaded into the X3D JSON Loader (yes I know itâ€™s problematic). In particular, if you store XML or JSON from untrusted sources and display them in the Loader, itâ€™s likely you will get an XSS attack. Please sanitize all input from untrusted source and make sure itâ€™s valid. We donâ€™t currently have XML Schema or XML Schematron for JSON data yet. We do have JSON schema, but it doesn't test scripts.
Itâ€™s in the license that I will not be liable for damages. Please use my software with care. I am not a security researcher.
If someone wants me to write a sanitizer for the X3D JSON Loader, I am willing to for $$$. I will need to run it by some security researchers.
Compiling and running Java, producing diffs of JSON input and output. The Java serializer produces a program which produces JSON. You can run the output from the serializer through the Java compiler and JVM with compilejava.sh. This will compile the java, run it, and provide a diff with the original JSON (if any). There are a couple of output zips for collecting output results.
also you can run "sh local.sh" or converting, running and diffing local files found in src/main/data.
Summary of shell scripts
These have been tested recently:
several.sh -- run several .x3d files through my conversion and compiling and running code. Recommend that you put the files in src/main/data and use sh several.sh ../data/file1.x3d ../data/file2.x3d ... all.sh -- run all .x3d in /c/x3d-code/www.web3d.org/x3d/content/examples through my conversion and compiling and running code found in several. Dangerous. Puts files in strange places right now. local.sh -- run src/main/data/*.x3d through several.sh don.sh -- run several .x3d files through don's conversion and compiling and running code. donlocal.sh -- run src/main/data/*.x3d through don.sh
You will need to set up your classpath accordingly. You can modify the file in src/main/shell/classpath to set your classpath. You will probably have to build the project with Maven 3. This is accomplished by running putting maven's bin folder in your path and running mvn install in the root folder, which will build any Java code found in src/main/java. I use net/coderextreme/RunSaxon.java to process stylesheets. Also, the website uses RunSaxon.java as well, so it would be good if you compiled it. You may need to configure the classpath in src/main/node/allsaxon.js as well.
The following are legacy code, and may be updated.