[x3d-public] loading DOM VRML Script. Cobweb enhancement?
Andreas Plesch
andreasplesch at gmail.com
Sun Dec 4 16:20:34 PST 2016
Hi John,
good points. It reminded me that there is GeoJSON http://geojson.org/ which
is popular and that it might be possible to transform into geospatial x3d
json.
-Andreas
On Sun, Dec 4, 2016 at 5:32 PM, <yottzumm at gmail.com> wrote:
> I view JSON as simpler to use than DOM. I like what I did with the
> prototype expander, adding functionality to X3DOM without having to use DOM
> (I used X3DJSONLD to create the DOM from the prototype expander JSON).
> JSON does has it’s disadvantages…I haven’t figured out how to do a
> listener/event handler/observer on tree changes yet.
>
>
>
> One of the reasons I took on JSON is for “JSON transformation by
> demonstration” I’d like to be able to transform the JSON with a GUI and
> have the series of steps recorded in a script. First though, I have to
> learn JSON transformation. Using XML for transformation has already been
> done—see XSLT, and IBM did XSL(T)bydemo, I believe (and there’s JOLT in
> Java). I have my own jtbd repository on GitHub, which basicially takes a
> list of JSON indices down a JSON tree down to a character and copies it to
> another tree. There’s also jsondemons, but that’s been morphed into a kind
> of 3D graph.
>
>
>
> John
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *Andreas Plesch <andreasplesch at gmail.com>
> *Sent: *Sunday, December 4, 2016 1:42 PM
> *To: *John Carlson <yottzumm at gmail.com>
> *Cc: *X3D Graphics public mailing list <x3d-public at web3d.org>; Roy
> Walmsley <roy.walmsley at ntlworld.com>; Don Brutzman <brutzman at nps.edu>
> *Subject: *Re: loading DOM VRML Script. Cobweb enhancement?
>
>
>
> Hi John,
>
> 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.
>
> 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.
>
> 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 ?
>
>
>
> http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/
>
> has good examples to test scripting. For example,
>
> http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/
> TouchSensorIsOverEventECMAScriptIndex.html
>
> http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/
> TouchSensorIsOverEventECMAScript.json
>
> I may give this example a try with the json loader and cobweb.
>
> -Andreas
>
>
>
> On Dec 4, 2016 1:49 AM, "John Carlson" <yottzumm at gmail.com> wrote:
>
> 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.
>
>
>
> On Dec 4, 2016 1:40 AM, "John Carlson" <yottzumm at gmail.com> wrote:
>
> Again, the X3D JSON Loader is a proof of concept patch until we get full
> JSON support in Cobweb and X3DOM, if desired.
>
>
>
> On Dec 4, 2016 1:24 AM, "John Carlson" <yottzumm at gmail.com> wrote:
>
> Because I may not have the full x3d examples downloaded. And I do want
> to test to see if JSON inclusion works.
>
>
>
> On Dec 2, 2016 3:04 PM, "Andreas Plesch" <andreasplesch at gmail.com> wrote:
>
> 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
>
>
>
--
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/20161204/3a3148e7/attachment.html>
More information about the x3d-public
mailing list