[x3d-public] X3DJSAIL/X3DJSONLD.java JSON export fails parse

John Carlson yottzumm at gmail.com
Sat Apr 3 13:24:38 PDT 2021


after recompiling/rearchiving X3DJSAIL, I don't see changes. Here are my 
diffs to X3DJSAIL's build.xml for Linux:


$ svn diff build.xml
Index: build.xml
===================================================================
--- build.xml   (revision 31641)
+++ build.xml   (working copy)
@@ -109,7 +109,7 @@

      <property name="stylesheets.dir" location="."/>

-    <property name=   "node" value="node.exe"/>
+    <property name=   "node" value="node"/>

      <!-- ant jar manifest properties -->
      <property name="user.name.build" value="Don Brutzman, 
brutzman at nps.edu"/>
@@ -142,9 +142,6 @@
          </exec>
          <!-- 
https://www.saxonica.com/documentation9.5/using-xsl/commandline.html -->
          <echo>saxon -? help</echo>
-        <java classname="net.sf.saxon.Transform" 
classpath="${saxon.dir}/${saxon.jar};." failonerror="true">
-        <arg value="-?" description="help information"/>
-        </java>
          <echo></echo>
          <!-- Ant environment variables 
https://ant.apache.org/manual/Tasks/property.html -->
          <echo>  ANT_HOME=${env.ANT_HOME}</echo>



Note that we've previously discussed -?. My guess is that it's not 
available on Linux, or I need to install ant.contrib, which I've just 
install.  I will retry, and post results elsewhere.


John

On 4/3/21 3:09 PM, John Carlson wrote:
> X3D JSON, as generated from X3DJSAIL (X3dToJson.xslt?) does not parse.
>
> Attaching examples/Json.json as exported from 
> /c/x3d-code/www.web3d.org/x3d/stylesheets/java/src/net/coderextreme/JsonConversion.java
>
> Suggestion:  use jsonlint to dignose newline or carriage-return in 
> @content value
>
> $ jsonlint examples/Json.json > HWPPP.json
> Error: Parse error on line 85:
> ...iption","@content":"Example HelloWorldP
> ----------------------^
> Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 
> 'undefined'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
>
> I am pretty much clueless at this point.  I think things point to 
> X3dToJson.xslt, but I'm unsure how the newline/carriage-return got 
> introduced.
>
> Another possible clue is here:
>
> HelloWorldProgramOutputX3dom.xhtml:         <meta content='Example 
> HelloWorldProgram creates an X3D model using the X3D Java Scene
>
> Perhaps some kind of copy/pasting going on?
>
> I recently upgraded, so I'm going to rebuild X3DJSAIL.  I didn't see 
> much in the diff, but maybe, just maybe.
>
> John
>
> On 4/3/21 2:39 PM, John Carlson wrote:
>> I will start looking at X3DLoaderDOM.java for possible issues.
>>
>> John
>>
>> On 4/3/21 2:37 PM, John Carlson wrote:
>>> 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