<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I’ve created a test.nashorn in java/nashorn/build.xml. You may call it if you like.  Make sure the current folder is java/nashorn (I am not sure if you can change current folder from within Java/Ant, except by invoking another virtual machine ala <exec>).</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Also, apply this patch, which removes nashorn folder from CreateX3dSceneAccessInterfaceJava.xslt, attached.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I think we need a “Nashorn Folder” configuration property, rather than removing it from the stylesheet.  And/Or a nashorn folder passed after -toJS on the command line.   That way, the intermediate and final  JS files can find the right locations for the JS scripts.   The final JS script should only load X3Dautoclass.js (unless of course, it’s converting to JS yet again).</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I think it would be better to invest some time in thinking about how to support a X3dToES5.xslt and X3dToES6.xslt (and X3dToPy.xslt, X3dToC#/C++, etc.  In otherwords, this whole thing with using a JavaScript program from within Java to convert JSON -> DOM -> JS is rather hokey at best.   We should go directly from DOM (probably preferred) or XML to Java, JS, Python, C#, C++, C etc.  I don’t think we should use JavaScript DOM for the final solution for X3DJSAIL.  If my code went directly from JSON -> JS it might make more sense, but right now, I use X3DJSONLD.js (produces JS DOM) for quite a bit of stuff.  In other words, I’m not good at serializing X3D JSON except by going through DOM.  Yes, DOM is a crutch, and convenient. Other pieces of X3DJSONLD, such as the prototype expander and the script handler do rely on JSON manipulation directly.   The prototype expander uses X3DJSONLD.js to convert back to DOM which is sent to X3DOM and and X_ITE (well, Cobweb).</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If we make X3D JSON a standard, then other tools will pick it up, and I won’t have to continue supporting the thing, and we’ll get more collective experience handling X3D JSON peculiarities, tips and tricks, etc.   We should probably put more focus on the X3D JSON encoding if we intend to make it a standard—or dump it in favor of XML and DOM, and chalk X3D JSON up as an experiment we are no longer interested in.   Yes, glTF will retain the performance advantage, but I doubt if X3D could ever really meet that—at least with the code I was development translating to DOM.  I’m guessing a direct X3D JSON -> Render would be performant.</p><p class=MsoNormal><br>I’d like to see if I can create a DOM version of the prototype expander.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In otherwords, don’t feel bad that X3D is going into the DOM sphere.  DOM is a good thing for X3D, IMHO.  However, it’s going to be hard to beat a JSON solution in glTF, so glTF should be leveraged as well.   There will be a DOM standard and a JSON standard that work together, let’s focus on a DOM standard for HTML5 and get it right.   And we’ll still be doing it the web way.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John</p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:brutzman@nps.edu">Don Brutzman</a><br><b>Sent: </b>Sunday, January 28, 2018 1:14 PM<br><b>To: </b><a href="mailto:yottzumm@gmail.com">John Carlson</a><br><b>Cc: </b><a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a><br><b>Subject: </b>Re: Problems generating files using build.xml target test.nashorn</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On 1/26/2018 2:13 AM, John Carlson wrote:</p><p class=MsoNormal>> This works instead of a script in build.xml:</p><p class=MsoNormal>> </p><p class=MsoNormal>>                  <exec executable="jjs"></p><p class=MsoNormal>> </p><p class=MsoNormal>>                          <arg value="-J-Djava.class.path=jars/X3DJSAIL.3.3.full.jar"/></p><p class=MsoNormal>> </p><p class=MsoNormal>>                          <arg value="nashorn/examples/HelloWorldProgramOutput.Nashorn.js"/></p><p class=MsoNormal>> </p><p class=MsoNormal>>                  </exec></p><p class=MsoNormal>> </p><p class=MsoNormal>> Everything is checked in.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Confirming yes, it is there and apparently working OK.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Shall I add test.nashorn to the smoke tests?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Here is output that I am currently seeing.  Still getting errors regarding nashorn/jvm-npm.js input.readAllBytes and package.json:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>========================================================================</p><p class=MsoNormal>ant -f C:\\x3d-code\\www.web3d.org\\x3d\\stylesheets\\java test.nashorn</p><p class=MsoNormal>test.nashorn:</p><p class=MsoNormal>Compile:</p><p class=MsoNormal>Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes</p><p class=MsoNormal>Copy:</p><p class=MsoNormal>Copying 1 file to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\nashorn\examples</p><p class=MsoNormal>Copying C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.x3d to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\nashorn\examples\HelloWorldProgramOutput.x3d</p><p class=MsoNormal>Copying 1 file to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\nashorn\examples</p><p class=MsoNormal>Copying C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.json to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\nashorn\examples\HelloWorldProgramOutput.json</p><p class=MsoNormal>Run:</p><p class=MsoNormal>parameter: source file HelloWorldProgramOutput.x3d filesize 20771 bytes</p><p class=MsoNormal>parameter: "-toJS" for conversion to X3DJSONLD JavaScript source</p><p class=MsoNormal>parameter: "-toFile" "nashorn/examples/HelloWorldProgramOutput.Nashorn.js" for result file name root nashorn/examples/HelloWorldProgramOutput.Nashorn</p><p class=MsoNormal>convert to JS JavaScript:</p><p class=MsoNormal>Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...</p><p class=MsoNormal>Warning: toFileJavaScript() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.Nashorn.js</p><p class=MsoNormal>Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>TypeError: input.readAllBytes is not a function</p><p class=MsoNormal>Error: Cannot read file [C:\x3d-code\www.web3d.org\x3d\stylesheets\java\nashorn\node_modules\xmldom\package.json]:</p><p class=MsoNormal>[Error] TODO problem handling local exception within CommandLine, exiting</p><p class=MsoNormal>org.web3d.x3d.sai.X3DException: ScriptException when processing fileName nashorn\examples\HelloWorldProgramOutput.Nashorn.js.intermediate.js, unable to save result: javax.script.ScriptException: Error: Cannot load JSON file in nashorn/jvm-npm.js at line number 216 at column number 8</p><p class=MsoNormal>                at org.web3d.x3d.jsail.Core.X3DObject.toFileJavaScript(X3DObject.java:1602)</p><p class=MsoNormal>                at org.web3d.x3d.jsail.CommandLine.run(CommandLine.java:557)</p><p class=MsoNormal>                at org.web3d.x3d.jsail.Core.X3DObject.handleArguments(X3DObject.java:2572)</p><p class=MsoNormal>                at HelloWorldProgramOutput.main(HelloWorldProgramOutput.java:400)</p><p class=MsoNormal>parameter: source file HelloWorldProgramOutput.x3d filesize 20771 bytes</p><p class=MsoNormal>parameter: "-toJSON" for conversion to JSON encoding</p><p class=MsoNormal>parameter: "-toFile" "nashorn/examples/HelloWorldProgramOutput.Nashorn.json" for result file name root nashorn/examples/HelloWorldProgramOutput.Nashorn</p><p class=MsoNormal>convert to JSON:</p><p class=MsoNormal>Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.json does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...</p><p class=MsoNormal>Warning: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior file nashorn/examples/HelloWorldProgramOutput.Nashorn.json</p><p class=MsoNormal>Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>file conversion successful: HelloWorldProgramOutput.Nashorn.json (39182 bytes)</p><p class=MsoNormal>parameter: source file HelloWorldProgramOutput.x3d filesize 20771 bytes</p><p class=MsoNormal>parameter: "-toX3D" for conversion to X3D encoding</p><p class=MsoNormal>parameter: "-toFile" "nashorn/examples/HelloWorldProgramOutput.Nashorn.x3d" for result file name root nashorn/examples/HelloWorldProgramOutput.Nashorn</p><p class=MsoNormal>convert to X3D:</p><p class=MsoNormal>Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.x3d does not meet suggested X3D naming conventions. Output serialization allowed to continue, file may be editable...</p><p class=MsoNormal>Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.Nashorn.x3d</p><p class=MsoNormal>file conversion successful: HelloWorldProgramOutput.Nashorn.x3d (20771 bytes)</p><p class=MsoNormal>===========================================</p><p class=MsoNormal>HelloWorldProgramOutput.Nashorn.x3d</p><p class=MsoNormal>1 file(s) have been successfully validated.</p><p class=MsoNormal>1 file(s) have been successfully validated.</p><p class=MsoNormal>matches HelloWorldProgramOutput.x3d: true</p><p class=MsoNormal>===========================================</p><p class=MsoNormal>script:</p><p class=MsoNormal>nashorn/examples/HelloWorldProgramOutput.Nashorn.js:1 TypeError: Cannot load script from node/X3Dautoclass.js</p><p class=MsoNormal>Result: 102</p><p class=MsoNormal>BUILD SUCCESSFUL (total time: 12 seconds)</p><p class=MsoNormal>========================================================================</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>p.s. this warning is overzealous, will try to tune that better:</p><p class=MsoNormal>"Warning: nashorn/examples/HelloWorldProgramOutput.Nashorn.js does not meet suggested X3D naming conventions."</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>all the best, Don</p><p class=MsoNormal>-- </p><p class=MsoNormal>Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman@nps.edu</p><p class=MsoNormal>Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149</p><p class=MsoNormal>X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>