[x3d-public] Differences between input JSON and output JSON

John Carlson yottzumm at gmail.com
Sat Jun 19 22:23:40 PDT 2021


Java with ConfigurationProperties set is attached.  The code works, 
except for 1) X3DLoaderDOM or 2) the toFileJSON/XML output.

I can't compare with test code Java output because currently Java is not 
output in Don's X3DJSAIL test.  It looks like the XML pretty printer is 
at fault, which might mean the scenegraph is wrong.   For example, 
search for Proto1 and Proto3

I think evidence is weighing towards the issue where X3DJSONLD DOM 
output is good, looking at LoadedJsonConversion.xml

So the evidence indicates that the following code may have issues:

                         X3DLoaderDOM  xmlLoader = new X3DLoaderDOM();

                         X3D X3D0 = 
(X3D)xmlLoader.toX3dModelInstance(document);
X3D0.toFileX3D("examples/JsonLoaderTest.x3d");
X3D0.toFileJSON("examples/JsonLoaderTest.json");


If you run JsonLoaderTest.java attached, you will see numerous log 
messages.  Place the java file in 
www_web3d_org/x3d/stylesheets/java/tests/org/web3d/x3d/tests and run in 
NetBeans.   Add the full X3DJSAIL jar to your path.


So we have a Java X3DJSONLD.java that seems to work, at least it gets 
good XML after the JSON is converted to DOM.


HWPO.json is original

JLT.json is the output

Both files have been formatted with jsonlint.

$ diff -w HWPO.json JLT.json
166a167,178
 >         },
 >         {
 >           "@name": "translated",
 >           "@content": "19 June 2021"
 >         },
 >         {
 >           "@name": "generator",
 >           "@content": "X3dToJson.xslt, 
https://www.web3d.org/x3d/stylesheets/X3dToJson.html"
 >         },
 >         {
 >           "@name": "reference",
 >           "@content": "X3D JSON encoding: 
https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
1308,1319d1319
<                 "ProtoInstance": {
<                   "@name": "NewWorldInfo",
<                   "@DEF": "Proto1",
<                   "fieldValue": [
<                     {
<                       "@name": "description",
<                       "@value": "testing 1 2 3"
<                     }
<                   ]
<                 }
<               },
<               {
1330,1335d1329
<                 "ProtoInstance": {
<                   "@name": "NewWorldInfo",
<                   "@DEF": "Proto3"
<                 }
<               },
<               {
1451,1457c1445
<                 "DISEntityManager": {
<                   "-children": [
<                     {
<                       "DISEntityTypeMapping": {}
<                     }
<                   ]
<                 }
---
 >                 "DISEntityManager": {}
1481,1487c1469
<           "DISEntityManager": {
<             "-children": [
<               {
<                 "DISEntityTypeMapping": {}
<               }
<             ]
<           }
---
 >           "DISEntityManager": {}
1497,1543d1478
<               },
<               {
<                 "Anchor": {
<                   "@USE": "siteAnchor"
<                 }
<               },
<               {
<                 "Inline": {
<                   "@USE": "inlineScene"
<                 }
<               },
<               {
<                 "DISEntityTypeMapping": {}
<               },
<               {
<                 "GeoMetadata": {}
<               },
<               {
<                 "AudioClip": {}
<               },
<               {
<                 "ImageCubeMapTexture": {}
<               },
<               {
<                 "ImageTexture3D": {}
<               },
<               {
<                 "ImageTexture": {}
<               },
<               {
<                 "MovieTexture": {}
<               },
<               {
<                 "Script": {}
<               },
<               {
<                 "PackagedShader": {}
<               },
<               {
<                 "ShaderPart": {
<                   "@type": "VERTEX"
<                 }
<               },
<               {
<                 "ShaderProgram": {
<                   "@type": "VERTEX"
<                 }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: JsonLoaderTest.java
Type: text/x-java
Size: 1190 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210620/594725bb/attachment-0001.bin>


More information about the x3d-public mailing list