[x3d-public] X3DJSAIL updates

John Carlson yottzumm at gmail.com
Sun Dec 17 13:43:27 PST 2017


With Native Java stylesheet engine (extra \’s), running output JavaScript:


test-nashorn:
    [javac] Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes
     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] HelloWorldProgramOutput self-validation test results: success
     [java] Warning: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior file nashorn/examples/HelloWorldProgramOutput.json
     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] HelloWorldProgramOutput self-validation test results: success
     [java] Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.x3d
     [java] HelloWorldProgramOutput self-validation test results: success

BUILD FAILED
C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml:1594: javax.script.ScriptException: SyntaxError: nashorn/examples/HelloWorldProgramOutput.js.intermediate.js:333:96 Expected comma but found ident
                                      "@value":["escaped quotation marks example 1: He said, \\"Immel did it!\\""]
                                                                                                ^ in <eval> at line number 5

With default stylesheet engine (extra newlines and extra \’s, so previous is preferable):

test-nashorn:
    [javac] Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes
     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] HelloWorldProgramOutput self-validation test results: success
     [java] Warning: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior file nashorn/examples/HelloWorldProgramOutput.json
     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] HelloWorldProgramOutput self-validation test results: success
     [java] Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.x3d
     [java] HelloWorldProgramOutput self-validation test results: success

BUILD FAILED
C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml:1594: javax.script.ScriptException: SyntaxError: nashorn/examples/HelloWorldProgramOutput.js.intermediate.js:57:83 Missing close quote
"@content":"Example HelloWorldProgram creates an X3D model using the X3D Java Scene
                                                                                   ^ in <eval> at line number 5

So how can we fix X3dToJson.xslt to produce proper JSON for these cases?  Note that JSON and XML output isn’t right either.  Note that original java, not generated Java produces correct results, so lets look at intermediate generated Java:

            .addValue(new MetadataStringObject().setName("escapedQuotesTest1").setValue(new MFStringObject("\"escaped quotation marks example 1: He said, \\\"Immel did it!\\\"\"")))

Which is correct.  So how do we either modify intermediate Java or downstream code to produce proper JSON (and XML) without affecting results produced by original Java?

Thanks,

John

PS:  I will work on converting my SAXON processes over to Native Java, if that’s OK with you.  It looks like Saxon is not the way to go?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20171217/1202d40e/attachment.html>


More information about the x3d-public mailing list