[x3d-public] X3DJSAIL/X3DJSONLD.java how to fix JsonConversion for modules.

John Carlson yottzumm at gmail.com
Sat Apr 3 12:37:07 PDT 2021


I know I am not presenting as well as I can. In summary, X3DJSONLD.java 
should look at containerFields and defaults (perhaps), and 
X3DLoaderDOM.java should look at DISEntityTypeMapping (children of 
DISEntityManager) and children of LoadSensor.  This will be a good start 
at finishing off X3DJSONLD extensions to X3DJSAIL, and likely enhance 
DOM document loading in X3DJSAIL.

==============================

I found an XML pretty printer.

The main differences between JsonConversion.java [ XML DOM output] 
(HWP.x3d, previously posted) and HelloWorldProgramOutput.x3d appear to 
be containerFields and default values.   ContainerFields are well known 
that I strip those out in X3DJSONLD.java...should be an easy fix.

HWPJSON.x3d is pretty printed X3D XML output from JsonConversion, and 
HWPO.x3d is pretty printed HelloWorldProgramOutput.x3d (see xmllint 
commands below).

Note that DISEntityTypeMapping is in the XML DOM output from 
JsonConversion.java (HWP.x3d), perhaps there's a problem with X3DLoaderDOM?


LoadSensor children don't seem to be handled in X3DLoaderDOM?


I can post output from running JsonConversion.java, if desired, it's 
kind of long.  I have already posted how to compile and run.

/c/x3d-code/www.web3d.org/x3d/stylesheets/java/src$ cat 
../examples/HelloWorldProgramOutput.x3d | xmllint --format - > HWPO.x3d
/c/x3d-code/www.web3d.org/x3d/stylesheets/java/src$ cat 
examples/Json.x3d | xmllint --format - > HWPJSON.x3d

/c/x3d-code/www.web3d.org/x3d/stylesheets/java/src$ diff HWPJSON.x3d 
HWPO.x3d
40,42d39
<     <meta content="04 February 2021" name="translated"/>
<     <meta content="X3dToJson.xslt, 
https://www.web3d.org/x3d/stylesheets/X3dToJson.html" name="generator"/>
<     <meta content="X3D JSON encoding: 
https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding" name="reference"/>
44a42
 >     <MetadataSet name="topLevelSceneMetadata"/>
223c221
<
---
 >
298a297,299
 >       <ProtoInstance DEF="Proto1" name="NewWorldInfo">
 >         <fieldValue name="description" value="testing 1 2 3"/>
 >       </ProtoInstance>
301a303
 >       <ProtoInstance DEF="Proto3" name="NewWorldInfo"/>
337c339,341
<       <DISEntityManager/>
---
 >       <DISEntityManager>
 >         <DISEntityTypeMapping/>
 >       </DISEntityManager>
345c349,351
<     <DISEntityManager/>
---
 >     <DISEntityManager>
 >       <DISEntityTypeMapping/>
 >     </DISEntityManager>
348a355,367
 >       <Anchor USE="siteAnchor"/>
 >       <Inline USE="inlineScene"/>
 >       <DISEntityTypeMapping/>
 >       <GeoMetadata/>
 >       <AudioClip containerField="children"/>
 >       <ImageCubeMapTexture containerField="children"/>
 >       <ImageTexture3D containerField="children"/>
 >       <ImageTexture containerField="children"/>
 >       <MovieTexture containerField="children"/>
 >       <Script/>
 >       <PackagedShader containerField="children"/>
 >       <ShaderPart containerField="children"/>
 >       <ShaderProgram containerField="children"/>



More information about the x3d-public mailing list