[X3D-Public] [x3dom-developers] initial X3D JSON conversion support using X3dToJson.xslt

doug sanden highaspirations at hotmail.com
Thu Oct 9 06:48:53 PDT 2014


I concur with Johannes on the A) no-defaults and D) explicit child placement (vs containerFeild), on the design principle "Noise reduction helps adoption".
-Doug
more..
Remember classic / vrml format could explicitly place child fields in the parent node. It was X3D via xml that needed containerField to disambiguate what field a child xml element was intended for in the parent node, when it wasn't obvious (example externProtoDeclares of appearance or shape). I haven't studied JSON, but if it doesn't have a problem - if it has syntax for directly placing SF and MFnode children in parent node fields like vrml classic did- then containerField is theoretically un-necessary. In practice, web3d browsers that never supported vrml/classic will find they need a slight re-arrangement in their parsing algorithm when transcribing it to support JSON.
In theory I should try some JSON before commenting. 

>
> Thanks for your effort.
>
> My comments on the code example:
>
> -------------------
> Group": [
> {
> "@bboxCenter": "0 0 0",
> "@bboxSize": "-1 -1 -1",
> "@containerField": "children"
> , "Viewpoint": {
> "@DEF": "ViewUpClose",
> "@centerOfRotation": "0 -1 0",
> "@description": "Hello world!",
> --------------------
>
> A) Why writing default values? They are skipped in every other encoding?
> B) Why is there always @ in front of every field name?
> C) Why not using the javascript native types for numbers and booleans?
> D) Why an extra "@containerField"?
>
> My encoding suggestion:
>
> Group": [
> {
> "bboxCenter": [0 0 0],
> "bboxSize": [-1 -1 -1],
> , "children" : [
> "Viewpoint": {
> "DEF": "ViewUpClose",
> "centerOfRotation": [-0 -1 0],
> "description": "Hello world!",
> }
>
> Faster to parse (using native types) more compact and more explicit in regards to the hierarchy connections.
>
> Best regards
> Johannes
>
>> Initial construction of X3D to JSON stylesheet is working. Examples attached.
>>
>> Working:
>> - elements, attributes, comments
>> - Square and squiggly brackets, commas
>> - escaping quotation marks
>>
>> TODO
>> - handling special characters
>> - elimination of default X3D attribute values
>> - CDATA text (for example, Script content)
>> - round-trip testing using a JSON-to-XML converter
>> - embedded support in X3D-Edit
>>
>> What X3D JSON specification will need to specify:
>>
>> - @attributeName
>> - "#comment"
>> - "#CDATA'
>>
>> Not possible:
>> - differentiate typing of string versus number values
>> - embedded JSON comments
>>
>> Example invocation from build.xml:
>> <target name="test.X3dToJson.xslt" depends="test.mkdir"
>> description="Test X3dToJson.xslt stylesheet using default Ant xslt task">
>> <xslt style="X3dToJson.xslt" in="${examples.dir}/HelloWorld.x3d" out="test/HelloWorld.json"/>
>> <echo message="converted test/HelloWorld.json"/>
>> <xslt style="X3dToJson.xslt" in="${examples.dir}/HelloWorld.x3d" out="test/HelloWorld.scene.json">
>> <param name="sceneGraphOnly" expression="true"/>
>> </xslt>
>> <echo message="converted test/HelloWorld.scene.json"/>
>> </target>
>>
>> p.s. once a web3d.org website problem is sorted out, these assets will reappear at
>> http://www.web3d.org/stylesheets
>>
>> Source updates remain are currently accessible via sourceforge at
>> http://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/
>> http://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/test
>>
>> all the best, Don
>> --
>> Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at 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
>> <HelloWorld.scene.json><HelloWorld.json><X3dToJson.xslt>------------------------------------------------------------------------------
>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
>> x3dom-developers mailing list
>> x3dom-developers at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/x3dom-developers
>
> ---
> Dr. Johannes Behr
> Head of Department: Visual Computing System Technologies
> Fraunhofer-Institut für Graphische Datenverarbeitung IGD
> Fraunhoferstr. 5 | 64283 Darmstadt | Germany
> Tel +49 6151 155-510 | Fax +49 6151 155-196
> johannes.behr at igd.fraunhofer.de | www.igd.fraunhofer.de
>
>
> _______________________________________________
> X3D-Public mailing list
> X3D-Public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
 		 	   		  


More information about the X3D-Public mailing list