[x3d-public] X3DJSAIL JSON loading testing

John Carlson yottzumm at gmail.com
Fri Jun 25 10:26:41 PDT 2021


This may be a more up to date JsonLoaderTest.java attached.

Please figure out how to include it in your tests.

John

---------- Forwarded message ---------
From: John Carlson <yottzumm at gmail.com>
Date: Sun, Jun 20, 2021 at 12:23 AM
Subject: Differences between input JSON and output JSON
To: Don Brutzman <brutzman at nps.edu>, X3D Graphics public mailing list <
x3d-public at web3d.org>


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 --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210625/5dceed2e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JsonLoaderTest.java
Type: application/ms-java
Size: 1226 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210625/5dceed2e/attachment.bin>


More information about the x3d-public mailing list