[x3d-public] Interesting Example

John Carlson yottzumm at gmail.com
Sat Jun 18 03:25:27 PDT 2016


Okay, I was able to make gears.json work with the X3D JSON Loader and the server side proto expander with cobweb.  I may have to work on the client side prototype expander some more to make it work with X3DOM (likely it’s a script issue  instead).

What I did was replace < and > before sending to CreateX3DFromString, avoiding any web browser interpretation.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Saturday, June 18, 2016 3:42 AM
To: Roy Walmsley; Don Brutzman
Cc: Holger Seelig; x3d-public at web3d.org
Subject: RE: Interesting Example

Okay, I figured out why the X3D JSON Loader wouldn’t load it. When I serialize the JSON to XML, the < and > get converted to < and >.  These are not valid to VRMLScript?  I am not sure.  I will try to do a replacement.  I think the best thing to do may be to create a CDATA Section instead of a text node, but I’m not ready to do that (doesn’t work with HTML, I’d say off the cuff).

I do have this, which appears to be partially working:

        // Fix CDATA sections
        xmlstr = xmlstr.replace(/<!\[CDATA\[/g, "<![CDATA[");
        xmlstr = xmlstr.replace(/\]\]>/g, "]]>");
        do {
                var xmlstr2 = xmlstr;
                xmlstr = xmlstr2.replace(/(\<\!\[CDATA\[(.|\n)*)<((.|\n)*\]\]\>)/gi, "$1<$3");
        } while (xmlstr !== xmlstr2);
        do {
                xmlstr2 = xmlstr;
                xmlstr = xmlstr2.replace(/(\<\!\[CDATA\[(.|\n)*)>((.|\n)*\]\]\>)/gi, "$1>$3");
        } while (xmlstr !== xmlstr2);

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Saturday, June 18, 2016 3:15 AM
To: Roy Walmsley; Don Brutzman
Cc: Holger Seelig; x3d-public at web3d.org
Subject: RE: Interesting Example

This example has a lot of scripting, and I doubt if my prototype expander is up to dealing with scripts yet.  If we could get
a version without scripts, I could try loading it.  As it is, even without the prototype expander, the X3D JSON Loader will not load gears.json, even with a Cobweb renderer.  Something to work on.

Sent from Mail for Windows 10

From: Roy Walmsley
Sent: Friday, June 17, 2016 6:32 AM
To: John Carlson; Don Brutzman
Cc: Holger Seelig; x3d-public at web3d.org
Subject: Interesting Example

Hi,

I have come across an interesting example, relating to the use of Scripts/Prototypes.

It is on the Cobweb site at http://titania.create3000.de/cobweb/. Scroll down to examples, navigate to Page 3 of the Examples list, and choose “Gears”.

This example is also available on Holger’s GitHub site at https://github.com/create3000/Library/tree/master/Examples/Gears. There are four files, of which two are XML encoded X3D. The file Rotor.x3d supplies a prototype declaration that is used within gears.x3d.

Try opening the file gears.x3d in different browsers!

I don’t know how you would get on with this one, John, in your prototype expander.

Roy



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160618/41136246/attachment-0001.html>


More information about the x3d-public mailing list