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

Behr, Johannes johannes.behr at igd.fraunhofer.de
Thu Oct 9 10:58:57 PDT 2014


On 9 Oct 2014, at 17:33, Leonard Daly <web3d at realism.com> wrote:

> Thanks for your comments Johannes, Doug, and Yvonne.
> 
>> 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?
>> 
> 
> In the follow-up comments I did not see this addressed.
> 
> The intent is to create a format that can be converted to any of the other X3D encodings. To make the round-trip conversion without putting a lot of smarts about the formats, some notation is needed to differentiate XML attributes from elements.

Why should we to this differentiation? The X3D spec handles SF/MF-Nodes like any other field. The XML encoding is just limited. 

Best regards
Johannes

> In this case Don has chosen the '@' symbol. I have also seen applications that use '-'. It seems to me that it is best to use some symbol that is not a legal first character for a variable name. 
> 
> Do people feel that this is necessary (differentiate attribute/field-names from elements/node-names)?
> If so, do you have a suggestion for a particular means of making this differentiation?
> 
> 
>> C) Why not using the javascript native types for numbers and booleans?
> 
> To do so would require parsing the XML to get the constituent parts of the attribute. Attributes with specific format (e.g., SFVec3F) would be relatively easy to do. Does it make sense to do so for the point field in a Coordinate node (or any other MF-type field)?
> 
> 
> Leonard Daly
> 
> 
> 
> 
>> 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
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> 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
>> 
>> 
>> 
> 
> 
> -- 
> Leonard Daly
> X3D Co-Chair
> Cloud Consultant
> President, Daly Realism - Creating the Future
> ------------------------------------------------------------------------------
> 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




More information about the X3D-Public mailing list