[x3d-public] HelloWorldProgramOutputCanonical.x3d Report/Discussion on X3DJSONLD serializers (not checked in). Problem with X3dToJson.xslt as run by X3DJSAIL.

John Carlson yottzumm at gmail.com
Sun May 9 17:35:19 PDT 2021


Don,


In summary,

When Java or X3DJSAIL is generating JSON, use:

ConfigurationProperties.setXsltEngine(ConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA);

To allow long lines.  I made an attempt at this at one point.

==

I need to use setMetadata instead of addValue/setValue for Metadata 
children of MetadataSet.  Needs to be verified. I need to undo changes 
to Serializers, and add setMetadata in mapToMethod2.js

==

Fix X3dToJson.xslt so extra quotes \" aren't generated in comments.  See 
HelloWorldProgramOutputCanonical.x3d (and .json) example.  Search for 
"alternative Java"

XML (correct):

<!-- alternative Java source: .setString(new String [] {"One, Two, 
Comment", "", "He said, \"Immel did it!\""}) -->


JSON (generated):

"#comment":"alternative Java source: .setString(new String [] {\"One, 
Two, Comment\", \"\", \"He said, \\\"\"Immel did it!\\\"\"\"})"

Desired JSON (test parsing before implementing):

"#comment":"alternative Java source: .setString(new String [] {\"One, 
Two, Comment\", \"\", \"He said, \\\"Immel did it!\\\"\"})"

Undesired XML (produced from Node):

<!-- alternative Java source: .setString(new String [] {"One, Two, 
Comment", "", "He said, \""Immel did it!\"""}) -->

Undesired JSON (produced by Java):

"#comment":"alternative Java source: .setString(new String [] {\"One, 
Two, Comment\", \"\", \"He said, \\\"\"\"Immel did it!\\\"\"\"\"})"

Note the extra \" that need to be stripped before writing out JSON.





More information about the x3d-public mailing list