converting X3D (XML) to X3D (JSON)

Extensible 3D (X3D) Graphics is the royalty-free open standard for publishing, viewing and archiving interactive 3D models on the Web.

Recent work has created an X3dToJson.xslt stylesheet, which takes .x3d scenes (in schema-validated XML encoding) to produce corresponding .json files.  This is an experimental effort to help create a formal JSON encoding for X3D Graphics.

 X3D to JSON Stylesheet Converter
 http://www.web3d.org/x3d/stylesheets/X3dToJson.html

This is pretty detailed.  We have found that certain JSON constraints do not map directly to XML.  For example, so far,
a. attributes are prefixed with @ symbol to facilitate context-free parsing.
b. JSON objects require ordered collections of similar children according to field type as unique keys,
c. JSON arrays allow unordered collections of children.
d. Comments can be included if a special key is used (#comment) but order is only partially preserved.

This has meant that some sorting of X3D scenes (documents) occurs.  For the syntax of X3D, preserving exact XML node order appears to not be completely possible.  For the semantics of X3D, which has some order dependence (DEF IDs must be defined prior to utilizing USE IDREFs for load-time performance), functional equivalence appears to be possible.

Implementation and evaluation testing continues, in particular on JSON structures and corresponding use of JSON loaders in 3D-capable javascript applications.

At present, X3D has multiple formally defined encodings:  .x3d in XML, .x3dv in ClassicVRML syntax, and .x3db Compressed Binary Encoding which integrates geometric compression with Fast Infoset (FI) XML compression.  Each is an ISO standard.

Current work includes creation of .x3de Efficient Binary Encoding using EXI, as well as the subject JSON encoding. We expect to advance both as candidate ISO standards as well.

Testing includes over 3000 X3D scenes of various sizes and shapes.  It is feasible to compare XML, JSON, EXI and EXI-style compression of JSON.

 X3D Resources: Examples
 http://www.web3d.org/x3d/content/examples/X3dResources.html#Examples

Additional future work: once this effort is complete, with round-trip conversion working (insofar as possible, some re-ordering occurs) we hope to look at producing an X3D JSON schema.  Since JSON Schema does not yet appear to be stable, it will be good to learn if convergence on a standard approach is occurring.

 http://json-schema.org

 JSON Schema: core definitions and terminology (expired 4 August 2013)
 http://tools.ietf.org/html/draft-zyp-json-schema-04

Design work occurs on x3d-public@web3d.org and further developments relevant to EXI will be posted on this list.  Feedback always welcome.  Have fun with X3D!

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman@nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

Received on Tuesday, 10 November 2015 16:26:57 UTC