[x3d-public] loading DOM VRML Script. Cobweb enhancement?

Andreas Plesch andreasplesch at gmail.com
Fri Dec 2 12:03:29 PST 2016


Hi John,

I tried a bit to load gears.json with X3DJSONLD:

https://raw.githubusercontent.com/andreasplesch/X3DJSONLD/master/AP_minimal_JSLD.html

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.

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.

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.

type="application/x-vrmlscript" 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.

-Andreas


On Thu, Dec 1, 2016 at 1:02 AM, <yottzumm at gmail.com> wrote:

> 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.
>
>
>
> This is with cobweb 2.4.
>
>
>
> John
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *yottzumm at gmail.com
> *Sent: *Thursday, December 1, 2016 12:32 AM
> *To: *Andreas Plesch <andreasplesch at gmail.com>; Don Brutzman
> <brutzman at nps.edu>; Roy Walmsley <roy.walmsley at ntlworld.com>
> *Subject: *FW: loading X3D DOM. Latest Cobweb techniques?
>
>
>
> Would it be possible to get a name/value of
>
>
>
> "@type" : "application/x-vrmlscript"
>
>
>
> On the Script tag in X3D JSON?  I will do some testing here first to see
> if it will help.
>
>
>
> John
>
>
>
> *From: *yottzumm at gmail.com
> *Sent: *Thursday, December 1, 2016 12:24 AM
> *To: *Andreas Plesch <andreasplesch at gmail.com>
> *Subject: *RE: loading X3D DOM. Latest Cobweb techniques?
>
>
>
> 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.
>
>
>
>
>
>
>



-- 
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20161202/ef24b84d/attachment.html>


More information about the x3d-public mailing list