[x3d-public] X3DJSAIL/X3DJSONLD.java JSON export fails parse
John Carlson
yottzumm at gmail.com
Wed Apr 7 13:43:58 PDT 2021
Oh, good, this popped up my radar again.
I believe the solution to this involves setting line lengths in Saxon. I
might look into configuration properties or various ways X3DJSAIL
configures Saxon.
Thanks for any additional bug reporting/fixing you might have.
This is pretty much the only thing that’s popped into my mind.
I need to do more JSON round tripping.
John
On Sat, Apr 3, 2021 at 3:09 PM John Carlson <yottzumm at gmail.com> 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"/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210407/a0a04ee5/attachment.html>
More information about the x3d-public
mailing list