<div dir="ltr"><p dir="ltr">Hi John,</p>
<p dir="ltr">X3dom is designed to work with the XML encoding or a dom. So for x3dom it would be necessary to first create a DOM from the json. It will be difficult to get around that.<br></p>
<p dir="ltr">Cobweb has parsers which parse XML or vrml into a scene graph. So it should be possible to make a parser for json, probably following what the XML parser does. But the easier path would be also to create a DOM from the json first.</p><p>How do you envision you or others would use json encoded x3d content to add value to a project ? Easier manipulation as a js object ? Easier programmatic content creation ? As an exchange/transmission format, a bit similar to gltf ?<br></p><p><br></p><p><a href="http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/">http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/</a></p><p>has good examples to test scripting. For example,<br></p><p><a href="http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/TouchSensorIsOverEventECMAScriptIndex.html">http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/TouchSensorIsOverEventECMAScriptIndex.html</a><br></p><p dir="ltr"><a href="http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/TouchSensorIsOverEventECMAScript.json">http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/TouchSensorIsOverEventECMAScript.json</a></p><p>I may give this example a try with the json loader and cobweb.<br></p><p>-Andreas</p><div class="gmail_extra"><br><div class="gmail_quote">On Dec 4, 2016 1:49 AM, "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p dir="ltr">Perhaps it's time for me to dig into Cobweb and X3DOM to see how they can be extended to support JSON?  If it's through DOM, which is fine by me, I would have to look and see how the various encodings are loaded after DOM is loaded.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Dec 4, 2016 1:40 AM, "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p dir="ltr">Again, the X3D JSON Loader is a proof of concept patch until we get full JSON support in Cobweb and X3DOM, if desired.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Dec 4, 2016 1:24 AM, "John Carlson" <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p dir="ltr">Because I may not have the full x3d examples downloaded.   And I do want to test to see if JSON inclusion works.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Dec 2, 2016 3:04 PM, "Andreas Plesch" <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi John,<div><br></div><div>I tried a bit to load gears.json with X3DJSONLD:</div><div><br></div><div><a href="https://raw.githubusercontent.com/andreasplesch/X3DJSONLD/master/AP_minimal_JSLD.html" target="_blank">https://raw.githubusercontent.<wbr>com/andreasplesch/X3DJSONLD/ma<wbr>ster/AP_minimal_JSLD.html</a><br></div><div><br></div><div>But even before any script parsing/loading, there is a problem with the ExternProtoDeclare node in gears.json. It has a url field to Rotor.x3d which is replaced by the json loader with Rotor.json before being handed off to cobweb with importDocument(). Cobweb does not know what to do with the Rotor.json file and gives up.</div><div><br></div><div>Why modify the url field value ? If the scene author wants to use a .json encoded scene, she will put it in  the url field just like a .wrl encoded scene.</div><div><br></div><div>On another note, I agree that eval() cannot be avoided if script should be supported. cobweb itself also uses eval() (after some setup and massaging) to run the x3d script.</div><div><br></div><div>type="application/x-vrmlscript<wbr>" is necessary because without it the web browser will try to run the script "as is" as soon as it gets appended to the page DOM. When cobweb gets a chance to check for the type attribute, it is already too late. So it cannot use the attribute to prevent it from running. It can only not reject it which is what it does.</div><div><br></div><div>-Andreas</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 1:02 AM,  <span dir="ltr"><<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_6814112949669356284m_7174440674528929433m_-637341298042191590m_4670831100320161873m_3334206258020055149m_-8313888796625588714WordSection1"><p class="MsoNormal">It appears that Cobweb is fouled up with DOM loading of scripts, even with the additional name value pair.  See gears.x3d/gears.json and load DOM through importDocument.  And independent test would help.  I am not sure which of my X3DCanvases gets loaded first and I am using absolute indexing, so it could be the XML loaded one that is failing.  Basically, we need a good way to load scripts coming in through JSON I think, and the only real way I know how to do it is eval or cobweb with JSON to XML conversion and VRMLscript.  If Cobweb could use the VRMLscript from JSON or DOM, that might be ideal.</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">This is with cobweb 2.4.</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">John</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">Mail</a> for Windows 10</p><p class="MsoNormal"><u></u> <u></u></p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) -moz-use-text-color -moz-use-text-color;padding:3pt 0in 0in"><p class="MsoNormal" style="border-width:medium;border-style:none;border-color:-moz-use-text-color;padding:0in"><b>From: </b><a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a><br><b>Sent: </b>Thursday, December 1, 2016 12:32 AM<br><b>To: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a>; <a href="mailto:brutzman@nps.edu" target="_blank">Don Brutzman</a>; <a href="mailto:roy.walmsley@ntlworld.com" target="_blank">Roy Walmsley</a><br><b>Subject: </b>FW: loading X3D DOM. Latest Cobweb techniques?</p></div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Would it be possible to get a name/value of  <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">"@<span class="gmail-m_6814112949669356284m_7174440674528929433m_-637341298042191590m_4670831100320161873m_3334206258020055149m_-8313888796625588714html-attribute-name"><span style="font-size:13.5pt;font-family:"courier new"">type"</span></span><span style="font-size:13.5pt;font-family:"courier new";color:rgb(136,18,128)"> : "</span><span class="gmail-m_6814112949669356284m_7174440674528929433m_-637341298042191590m_4670831100320161873m_3334206258020055149m_-8313888796625588714html-attribute-value"><span style="font-size:13.5pt;font-family:"courier new"">application/x-vrmlscript"</span></span><span style="font-size:13.5pt;font-family:"courier new";color:rgb(136,18,128)"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:13.5pt;font-family:"courier new";color:rgb(136,18,128)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:13.5pt;font-family:"courier new";color:rgb(136,18,128)">On the Script tag in X3D JSON?  I will do some testing here first to see if it will help.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:13.5pt;font-family:"courier new";color:rgb(136,18,128)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:13.5pt;font-family:"courier new";color:rgb(136,18,128)">John</span><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) -moz-use-text-color -moz-use-text-color;padding:3pt 0in 0in"><p class="MsoNormal"><b>From: </b><a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a><br><b>Sent: </b>Thursday, December 1, 2016 12:24 AM<br><b>To: </b><a href="mailto:andreasplesch@gmail.com" target="_blank">Andreas Plesch</a><br><b>Subject: </b>RE: loading X3D DOM. Latest Cobweb techniques?<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">One thing I noticed once I got both DOM and XML views loaded, was that I think the DOM VRML script tag was disabled, but the XML one worked.  Was there some attribute to add to the Script tag to make it work?  Can I add it in both XML and DOM?  Thanks, John  I will start email search.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail-m_6814112949669356284m_7174440674528929433m_-637341298042191590m_4670831100320161873m_3334206258020055149gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>
</div>