Difference between revisions of "X3D JSON Encoding"

From Web3D.org
Jump to: navigation, search
(Conversion Issues)
(Conversion Issues)
Line 11: Line 11:
  
 
# How to convert attribute names to distinguish them from child elements
 
# How to convert attribute names to distinguish them from child elements
# Handling of container elements to preserve parent/child relationships, distinguishing child elements from attributes
+
# JSON handling of container elements to preserve parent/child relationships, distinguishing child elements from attributes
 
# Creation of JSON elements with datatypes appropriate to content (e.g., integer, float, strings, etc.)
 
# Creation of JSON elements with datatypes appropriate to content (e.g., integer, float, strings, etc.)
 
# Inclusion of XML namespaces
 
# Inclusion of XML namespaces

Revision as of 15:29, 10 September 2014

Preliminary notes on the creation of an X3D JSON encoding.

  • This page is to understand the conversion process so that a high-quality encoding definition can be created
  • Don Brutzman started a thread on the X3D-Public list.
    • Initial message [1]
    • July's thread listing [2]

Conversion Issues

Primary design criterion: round-trippable lossless representation of X3D scene.

Conversion approach of greatest interest: XML to/from JSON. Issues:

  1. How to convert attribute names to distinguish them from child elements
  2. JSON handling of container elements to preserve parent/child relationships, distinguishing child elements from attributes
  3. Creation of JSON elements with datatypes appropriate to content (e.g., integer, float, strings, etc.)
  4. Inclusion of XML namespaces
  5. Handing of comments in the source
    • {LD} I don't see an issue of dropping comments during conversion. This is not suppose to be a conversion of files to maintain an archive, but a conversion for use. JSON does provide comment mechanisms.
    • {DPB} Each X3D encoding needs an option for inclusion of comments in order to ensure 100% round-trip conversion capabilities.
  1. Support for singleton (self-closing) tags also needed

Discussion points

Here are suggested discussion points for the X3D teleconference and future followups.

  1. What are the use cases for having X3D JSON available in JavaScript? It would be good to spell them out and understand them well.
  2. Is there a good/consistent way for X3DOM to utilize such capabilities?
  3. Is there a way for Three.js or other javascript libraries to utilize such capabilities?
  4. Is there a single authoritative reference for JSON itself? and for JSON-XML conversions?
  5. Compare compression of a TestMesh.x3d.json.gz to TestMesh.x3db and TestMesh.x3d.exi (EXI will likely win because it includes data typing)
  6. Once a canonical form for X3D as JSON is established, add conversion capabilities to X3D-Edit and also autoconvert, test and publish JSON for all of the 3800+ scenes in the X3D Examples Archives
  7. Decide if this capability needs to be defined in one of the X3D standards, or perhaps as an X3D best practice.
  8. Probably lots more... What else?

Contributors

  • LD - Leonard Daly
  • DPB - Don Brutzman

References

  • XML to JSON Converter (provides option to assign a prefix to JSON attributes, default is @ character) [3]
  • Apache Camel, XML JSON Data Format (camel-xmljson) [4]
  • JSON Markup Language (JsonML) [5]
  • XSLTJSON: Transforming XML to JSON using XSLT [6]
  • Converting Between XML and JSON [7]
  • XML/JSON Perl Converter [8]
  • IBM's PHP converter [9]
  • Java Converter [10]
  • Google Code Library [11]