[x3d-public] any clues as to why the JSON display on the left looks different from the XML display on the right? Which is correct? Files with similar results attached. Inline is not working in XML is what I think. In fact, the Inline is not even there! more la

Roy Walmsley roy.walmsley at ntlworld.com
Tue Jun 7 03:05:30 PDT 2016


John,

 

The JSON file that you attached is invalid, failing schema validation. There are two types of errors:

 

The first is simply that it doesn’t include the now mandatory “encoding” property within the “X3D” object. However, this has no bearing on your results.

 

The second is the “@DEF” statements. There are 35 that fail validation. This is due to the fact that the “@DEF” is in the wrong place. Looking at the first instance on line 323, here is the definition of the Shape node surrounding it. 

 

                            "Shape": {

                              "-appearance": {

                                "Appearance": {

                                  "-material": {

                                    "Material": {

                                      "@ambientIntensity": 0.25,

                                      "@diffuseColor": [

                                        0.282435,

                                        0.085159,

                                        0.134462

                                      ],

                                      "@shininess": 0.127273,

                                      "@specularColor": [

                                        0.276305,

                                        0.11431,

                                        0.139857

                                      ]

                                    },

                                    "@DEF": "DECLArtDeco00_INSTANCE_DECLArtDeco00_INSTANCE"

                                  }

                                }

                              },

                              "-geometry": {

                                "Sphere": {

                                  "@DEF": "Ball",

                                  "@radius": 0.5

                                }

                              }

                            }

 

What node is the “@DEF” meant to apply to? If we simplify it by removing the properties within the Material node, the problem becomes easier to see:

 

                            "Shape": {

                              "-appearance": {

                                "Appearance": {

                                  "-material": {

                                    "Material": {

                                    },

                                    "@DEF": "DECLArtDeco00_INSTANCE_DECLArtDeco00_INSTANCE"

                                  }

                                }

                              },

                              "-geometry": {

                                "Sphere": {

                                  "@DEF": "Ball",

                                  "@radius": 0.5

                                }

                              }

                            }

 

You have the “@DEF” as a child of the “-material” field. It needs to be either a child of the Material node or the Appearance node, as appropriate. I reviewed the JSON encoding of the file with the prototypes, and see that it is meant to a property of the Material node. Therefore, the shortened coding would be:

 

                            "Shape": {

                              "-appearance": {

                                "Appearance": {

                                  "-material": {

                                    "Material": {

                                      "@DEF": "DECLArtDeco00_INSTANCE_DECLArtDeco00_INSTANCE"

                                    }

                                  }

                                }

                              },

                              "-geometry": {

                                "Sphere": {

                                  "@DEF": "Ball",

                                  "@radius": 0.5

                                }

                              }

                            }

 

And with the other properties back in, this becomes (assuming that you put the “@DEF” first):

 

                            "Shape": {

                              "-appearance": {

                                "Appearance": {

                                  "-material": {

                                    "Material": {

                                      "@DEF": "DECLArtDeco00_INSTANCE_DECLArtDeco00_INSTANCE",

                                      "@ambientIntensity": 0.25,

                                      "@diffuseColor": [

                                        0.282435,

                                        0.085159,

                                        0.134462

                                      ],

                                      "@shininess": 0.127273,

                                      "@specularColor": [

                                        0.276305,

                                        0.11431,

                                        0.139857

                                      ]

                                    }

                                  }

                                }

                              },

                              "-geometry": {

                                "Sphere": {

                                  "@DEF": "Ball",

                                  "@radius": 0.5

                                }

                              }

                            }

 

I tried to load the original JSON file into my own viewer, but it failed (so debugging is required). I then tried the XML encoding. It too crashed (double debugging required!!). Sorry I can’t be more helpful.

 

Regards,

 

Roy

 

From: John Carlson [mailto:john.carlson3 at sbcglobal.net] 
Sent: 07 June 2016 02:35
To: Don Brutzman; Roy Walmsley; x3d-public at web3d.org
Subject: any clues as to why the JSON display on the left looks different from the XML display on the right? Which is correct? Files with similar results attached. Inline is not working in XML is what I think. In fact, the Inline is not even there! more later

 

 



 

 

 

 

 

Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986>  for Windows 10

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160607/1ffedb4b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 125880 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160607/1ffedb4b/attachment-0001.png>


More information about the x3d-public mailing list