[x3d-public] X3dToJson.xslt, X3D JSON to X3D XML, X3D Canonicalizer, comparison

John Carlson yottzumm at gmail.com
Sun Mar 27 18:41:11 PDT 2016


This mail wasn’t sent because it was too large, but it had some important notes in it I’d like to bring up in addition to a new repository for source code.


The Canonicalizer should:

1.  Canonicalize numbers or fail on bad numbers.  Alternatively, suggest a canonical format for the X3DJSON Loader to write out.

2.  Take out default values or put them in where not specified

3.  Put in container fields if not present, or take them out if not needed (defaults).

The stylesheet should not:

1.  Faithfully respect the XML source with respect to default values.

The X3D JSON loader should:

1.  Populate the containerField attribute in XML.

Since a straight diff was not practical due to numbers, and I didn’t want to program xmlunit to handle number arrays (has someone already?),  I wrote my own xmldiff.js to handle xml comparisons.  xmldiff.js uses xml2js, which I believe the license is here: https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/LICENSE <https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/LICENSE> but it’s not distributed with it, so you may want to download the full package, which requires lodash (MIT), sax (ISC, W3C) and xmlbuilder (MIT).  The file json2x3d.js requires xmldom (MIT or LPGL).  If you have another way of generating XML from JSON, you can program that instead of using json2x3d.js The additional packages are installed during installation (npm install), so you may download the repository without being polluted by source code, just if you install, you get the dependencies.

The repository is found here:

https://github.com/coderextreme/x3droundtrip <https://github.com/coderextreme/x3droundtrip> [ Licensed under Open-Source Software License for Web3D Consortium ]

The repository includes source code I’ve written for the X3D JSON Loader, but is a separate distribution, without the licenses for content.  This is a stripped down version, targeted at generating XML from the loader, but the code should be identical.

It also requires Linux/MacOS shell utilities and node.js.  I will work on getting rid of the dependency on Linux/MacOSX (but likely there are alternatives…)

Note that this package will write and perhaps overwrite XML (.x3d) files in /www.web3d.org <http://www.web3d.org/> or wherever your JSON files are found if you change the $EXAMPLES in toxml.sh.  It also requires original .x3d files alongside the JSON files to run through the canonicalizer.   The generated files will include "-roundtrip” (json2x3d.js does this) and “Canonical”  (the Canonicalizer does this) If you have files like that, you may want to make copy your JSON and X3D files elsewhere.  I will work on configuration of these items.  If desired, I can copy the files elsewhere.

It would probably be simpler to change xmlunit to handle number arrays.

John


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160327/3f4b608e/attachment.html>


More information about the x3d-public mailing list