[x3d-public] Jsonix XML -> JSON output converted to standard X3D JSON via script

John Carlson john.carlson3 at sbcglobal.net
Sun Nov 15 20:21:11 PST 2015


The X3dToJson.xslt script failing on several scenes motivated this message.

I have written a script that I have been able to convert a couple of Jsonix generated JSON (using my custom XML schema) files into X3D JSON.

The script is called JSON2JSON.js and is here: https://github.com/coderextreme/x3djson/blob/master/JSON2JSON.js <https://github.com/coderextreme/x3djson/blob/master/JSON2JSON.js>  The license can be found at https://github.com/coderextreme/x3djson/LICENSE <https://github.com/coderextreme/x3djson/LICENSE>


A previously untranslatable X3D XML file, due to memory consumption, has been converted to X3D JSON.  You can find it here:

https://github.com/coderextreme/x3djson/blob/master/IcosahedronSubdivisionLevel5.json?raw=true <https://github.com/coderextreme/x3djson/blob/master/IcosahedronSubdivisionLevel5.json?raw=true>

This has successfully been loaded into my X3D JSON loader.

I am not sure I can offer a general case solution because Jsonix generates strange names that I have to replace (see mapp in the script).  I have been able to translate 2 files.

If we cannot fix the memory consumption issue for the style sheet, I can translate the X3D XML with my script and modify the script per file if necessary.

I had to get the X3D XML file to translate from SVN.  X3dForAdvancedModeling is not downloading properly.

These are a list of JSON files with 0 size.  I am guessing these are the ones that failed XSLT.  I will start work on these if there isn’t a more pressing issue.

./Basic/ExperimentalBinaryCompression/Lion.json
./Basic/ExperimentalBinaryCompression/LionCoded.json
./Basic/Geospatial/MarsLOD002.json
./Basic/Geospatial/MarsLOD005.json
./Basic/Geospatial/MarsLOD008.json
./Basic/Geospatial/MarsLOD011.json
./Basic/Geospatial/MarsLOD017.json
./Basic/Geospatial/MarsLOD020.json
./Basic/Geospatial/MarsLOD023.json
./Basic/Medical/BodySkinIndexedFaceSetNIST.json
./Basic/Medical/BonesAllSkeleton.json
./Basic/Medical/BonesHead.json
./Basic/Medical/BonesMandible.json
./Basic/Medical/SkeletonCompleteNoNormals.json
./Basic/Medical/SkeletonCompleteNormals.json
./Basic/Shaders/Flutter.json
./Basic/StudentProjects/AllenDutton.json
./Basic/StudentProjects/LaetitiaSprints.json
./ConformanceNist/Appearance/PixelTexture/256PixelTexture.json
./ConformanceNist/GeometricProperties/Coordinate/15000points_lineset.json
./ConformanceNist/Geometry/IndexedLineSet/15000-polylines-defcolor.json
./ConformanceNist/Geometry/IndexedLineSet/15000-Vertices.json
./Savage/AircraftFixedWing/B52H-StrategicBomber-UnitedStates/B52HStatic.json
./Savage/AircraftHelicopters/JhlHeavyLift-NPS/JointHeavyLiftHelicopter.json
./Savage/Locations/CampPendletonCalifornia/CampPendletonOperatingAreasExample.json
./Savage/Locations/FortLauderdaleFlorida/FortLauderdaleDepths10m.json
./Savage/Locations/FortLauderdaleFlorida/FortLauderdaleDepths20m.json
./Savage/Locations/MontereyBayCalifornia/MontereyBayLargeMesh.json
./Savage/Robots/UnmannedUnderwaterVehicles/Bluefin21BPAUV.json
./Savage/Scenarios/RemusMission10MAR2003/RemusMissionLineTrackPlayback.json
./Savage/Scenarios/UssColeTerroristAttack/AdenHarbor.json
./Savage/Scenarios/UssColeTerroristAttack/AdenHarborSmallScale.json
./Savage/ShipsCivilian/PersonalWaterCraft/JetskiWithRider.json
./Savage/ShipsCivilian/ResearchVessels/Endeavor.json
./Savage/Tools/Authoring/GridsExamplePixelTexture.json
./X3dForAdvancedModeling/GeometricShapes/IcosahedronSubdivisionLevel5.json
./X3dForAdvancedModeling/Matlab/PhasedArrayBeamExample.json


I can also write a script which takes an X3D XML file, with a little work.


This provides a more JavaScript (rather than XSLT) way of translating files to the X3D JSON standard.  I don’t know where the mappings from XML -> JSON come from other than Jsonix and xjc. I will look into what we can do with the mappings generated by Jsonix to use standard Jsonix tools to do the full translation.

I haven’t looked at ROUTEs yet.  I am just concerned with files which fail at this point.  Just getting a second way to translate X3D XML to X3D JSON seems like a major accomplishment!


Now if only I could automatically update the JSON schema generated by Jsonix given my script!  Something to dream about!

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


More information about the x3d-public mailing list