[x3d-public] Fwd: Testing X3DJSAIL from NetBeans. IMPORTANT!

John Carlson yottzumm at gmail.com
Fri Jun 25 10:20:30 PDT 2021


There should be a Java attachment to this email.
Please try to run in with the X3DJSAIL jar in the classpath.

John

---------- Forwarded message ---------
From: John Carlson <yottzumm at gmail.com>
Date: Sat, Jun 19, 2021 at 6:49 PM
Subject: Re: Testing X3DJSAIL from NetBeans. IMPORTANT!
To: Don Brutzman <brutzman at nps.edu>, X3D Graphics public mailing list <
x3d-public at web3d.org>


Here are the 2 telling diffs (minus output):

x3d/stylesheets/java/examples$ diff JsonLoaderTest.x3d
HelloWorldProgramOutputCanonical.xml |less

At the end of the diff, there is:

362a369,381
 >       <Anchor USE='siteAnchor'/>
 >       <Inline USE='inlineScene'/>
 >       <DISEntityTypeMapping/>
 >       <GeoMetadata/>
 >       <AudioClip/>
 >       <ImageCubeMapTexture/>
 >       <ImageTexture3D/>
 >       <ImageTexture/>
 >       <MovieTexture/>
 >       <Script/>
 >       <PackagedShader/>
 >       <ShaderPart/>
 >       <ShaderProgram/>


So there are a lot of elements removed by JsonLoaderTest.java

x3d/stylesheets/java/examples$ diff -w LoadedJsonConversion.xml
HelloWorldProgramOutputCanonical.xml |less


No comparable list of missing elements in LoaderJsonConversion.xml,
which comes after X3DJSONLD loading.


Indeed, they appear to be present:


426,427c369,370
<             <Anchor USE="siteAnchor"/>
<             <Inline USE="inlineScene"/>
---
 >       <Anchor USE='siteAnchor'/>
 >       <Inline USE='inlineScene'/>
437,438c380,381
<             <ShaderPart type="VERTEX"/>
<             <ShaderProgram type="VERTEX"/>
---
 >       <ShaderPart/>
 >       <ShaderProgram/>


This is the main reason why I think X3DLoaderDOM.java is the issue.
But it's not detectable by loading the XML with X3DLoaderDOM--only the
DOM created from X3DJSONLD, which seems very confusing.

AAAAAAAAAAAAAAAAAAAAAAAAAAARGH!

And there appear to be a lot of errors with LoadSensor in the NetBeans
logs.  That will lead towards a solution for that.


Then there's the DIS stuff.  We'll get to that next.

John

On 6/19/21 6:23 PM, John Carlson wrote:
> I think the issue here is the unvalidated scene graph.  That's why I
> write out the XML after loading with X3DJSONLD before I send it to
> X3DLoaderDOM.  My problem is, I don't know what to compare the
> intermediate XML with. What I will attempt to do is read in
> HelloWorldProgramOutputCanonical.xml and see if I get the same
> X3DLoaderDOM issues.
>
>
> John
>
>
> *** [X3DLoaderDOM error] Incorrectly handled X3DJSAIL object
> construction, current elementObject=LoadSensor (LoadSensor),
> child="Anchor", containerField="", java.lang.ClassCastException: class
> org.web3d.x3d.jsail.Networking.LoadSensor cannot be cast to class
> org.web3d.x3d.sai.Grouping.X3DGroupingNode
> (org.web3d.x3d.jsail.Networking.LoadSensor and
> org.web3d.x3d.sai.Grouping.X3DGroupingNode are in unnamed module of
> loader 'app')
>     This error can be caused by incorrect parent-child node
> relationships or incorrect containerField values.
>     X3D node typing is strict, check or validate your scene graph!
>     This error can also be caused by X3DLoaderDOM DOM omissions in
> X3DJSAIL. Please report mysterious problems, thank you.
>
> *** [X3DLoaderDOM error] Parent-child node relationship not found!
> (parent LoadSensor, child Inline, containerField='') Please report
> this problem to brutzman at nps.edu
> java.lang.ClassCastException: class
> org.web3d.x3d.jsail.Networking.LoadSensor cannot be cast to class
> org.web3d.x3d.sai.Grouping.X3DGroupingNode
> (org.web3d.x3d.jsail.Networking.LoadSensor and
> org.web3d.x3d.sai.Grouping.X3DGroupingNode are in unnamed module of
> loader 'app')
>     at
>
org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:1352)
>     at
> org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:619)
>     at
> org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:619)
>     at
> org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:490)
>     at
> org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:453)
>     at org.web3d.x3d.tests.JsonLoaderTest.main(JsonLoaderTest.java:23)
>
> On 6/19/21 6:14 PM, John Carlson wrote:
>> The important point from all of this, is that JSON input to X3DJSAIL
>> does not produce XML that is compatible with Java the JSON was
>> created from.  Indeed, I don't even know if the non-canonical XML is
>> compatible with the canonical XML. I don't know how to build the
>> HelloWorldProgramOutputCanonical.x3d at this point (oh, there's a
>> .xml version).   Where is an officially generated XML file that I can
>> compare against, and all I have is Java? I'm really getting confused
>> comparing all these different XML files. I would prefer to compare
>> JSON from Java (generated in Don's test) to JSON from Java (in my
>> test), so we can properly test my usage of the X3DLoaderDOM to load
>> my Document that I created from JSON in X3DJSONLD.java
>>
>> I created a test in NetBeans, under
>>
www_web3d_org/x3d/stylesheets/java/tests/org/web3d/x3d/tests/JsonLoaderTest.java

>> (attached), derived from JsonConversion.java
>>
>> I ran the file, it's not a proper JUnit test case.
>>
>>
>> It produced 2 .x3d files, an .xml file, and no .json file, perhaps
>> because of this output?
>>
>> CLASSPATH=/c/x3d-code/
www.web3d.org/x3d/stylesheets/java/classes:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/exificient-gui-jar-with-dependencies.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/jdom.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/javax.json-api-1.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/jaxb/jaxb-api.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/nagasena.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/nagasena-rta.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/saxon9he.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/X3dC14n.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/junit-platform-commons-1.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/opentest4j-1.1.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/junit-platform-launcher-1.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/jupiter/junit-jupiter-api-5.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/jupiter/junit-jupiter-engine-5.5.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/lib/support/apiguardian-api-1.1.0.jar:/c/x3d-code/www.web3d.org/x3d/stylesheets/java/classes/test/classes
>>
>>   invoked from toFileStylesheetConversion(X3dToJson.xslt,
>> examples/JsonLoaderTest.json, normalizeCommentWhitespace, true, , )
>>
>>     at
>> org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1171)
>>     at
>> org.web3d.x3d.jsail.Core.X3D.toFileStylesheetConversion(X3D.java:1024)
>>     at org.web3d.x3d.jsail.Core.X3D.toFileJSON(X3D.java:1835)
>>     at org.web3d.x3d.tests.JsonLoaderTest.main(JsonLoaderTest.java:23)
>>
>> (The X3DJSAIL jar file wasn't found--Not going there right now)
>>
>> The files are here:
>>
>>
./www_web3d_org/x3d/stylesheets/java/tests/org/web3d/x3d/tests/JsonLoaderTest.java

>>
>> ./www_web3d_org/x3d/stylesheets/java/examples/JsonLoaderTest.x3d
>>
./www_web3d_org/x3d/stylesheets/java/examples/JsonLoaderTestPrettyPrint.intermediate.x3d

>>
>>
>> ./www_web3d_org/x3d/stylesheets/java/examples/LoadedJsonConversion.xml
>>
>>
>> Here is an important diff to project.properties for cross-platform
>> compatibility:
>>
>> ndex: java/nbproject/project.properties
>> ===================================================================
>> --- java/nbproject/project.properties   (revision 32247)
>> +++ java/nbproject/project.properties   (working copy)
>> @@ -37,17 +37,17 @@
>>  endorsed.classpath=
>>  excludes=
>>  file.reference.java-src=src
>>
-file.reference.apiguardian-api-1.0.0.jar=C:\\apache-ant-1.10.5\\lib\\apiguardian-api-1.0.0.jar

>>
>>
+file.reference.apiguardian-api-1.0.0.jar=lib/support/apiguardian-api-1.1.0.jar

>>
>>  file.reference.jdom.jar=lib/jdom.jar
>>
-file.reference.junit-jupiter-api.jar=C:\\apache-ant-1.10.5\\lib\\jupiter\\junit-jupiter-api.jar

>>
>>
-file.reference.junit-jupiter-engine.jar=C:\\apache-ant-1.10.5\\lib\\jupiter\\junit-jupiter-engine.jar

>>
>>
-file.reference.junit-platform-commons.jar=C:\\apache-ant-1.10.5\\lib\\junit-platform-commons.jar

>>
>>
-file.reference.junit-platform-engine.jar=C:\\apache-ant-1.10.5\\lib\\junit-platform-engine.jar

>>
>>
-file.reference.junit-platform-launcher.jar=C:\\apache-ant-1.10.5\\lib\\junit-platform-launcher.jar

>>
>>
+file.reference.junit-jupiter-api.jar=lib/support/jupiter/junit-jupiter-api-5.5.0.jar

>>
>>
+file.reference.junit-jupiter-engine.jar=lib/support/jupiter/junit-jupiter-engine-5.5.0.jar

>>
>>
+file.reference.junit-platform-commons.jar=lib/support/junit-platform-commons-1.5.0.jar

>>
>>
+file.reference.junit-platform-engine.jar=lib/support/junit-platform-engine-1.5.0.jar

>>
>>
+file.reference.junit-platform-launcher.jar=lib/support/junit-platform-launcher-1.5.0.jar

>>
>>  file.reference.jaxb-api.jar=lib/support/jaxb/jaxb-api.jar
>>  file.reference.nagasena-rta.jar=lib/nagasena-rta.jar
>>  file.reference.nagasena.jar=lib/nagasena.jar
>>
-file.reference.opentest4j-1.1.0.jar=C:\\apache-ant-1.10.5\\lib\\opentest4j-1.1.0.jar

>>
>> +file.reference.opentest4j-1.1.0.jar=lib/support/opentest4j-1.1.0.jar
>>
 file.reference.exificient-gui-jar-with-dependencies.jar=lib/exificient-gui-jar-with-dependencies.jar

>>
>>  file.reference.javax.json-api-1.0.jar=lib/javax.json-api-1.0.jar
>>  file.reference.saxon9he.jar=lib/saxon9he.jar
>>
>> There are scads more things to deal with JavaLoaderTest.java, as have
>> been previously reported, but from my diffs, and all the errors
>> thrown, it kind of appears that the X3DLoaderDOM is causing the
>> problem.   But I agree it could be indenting/parent-child issues with
>> X3DJSONLD.  I just haven't got any smoking gun which points to
>> X3DJSONLD in my diffs. Someone more experienced with diffing XML (and
>> has diffing tools like XMLSpy should take over debugging).
>>
>> So we can load JSON, roughly, but there are problems writing out
>> JSON.  I haven't figured out if there's an issue with loading the
>> JSON yet, as the XML printed in the middle,
>> "examples/LoadedJsonConversion.xml", has different indenting and
>> quoting.  What I used to verify the JSON was the output JSON, which
>> is currently unavailable due to X3DJSAIL jar not being in the CLASSPATH.
>>
>> We have a good test case and code, it's just that my XML diffing
>> tools are crap.
>>
>> I will pursue running under debug next.
>>
>> John
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210625/73e4f31c/attachment-0001.html>


More information about the x3d-public mailing list