[x3d-public] possible issue with X_ITE with Edge; CDATA sections not showing up in Edge XML textareas.

John Carlson yottzumm at gmail.com
Sat Mar 31 13:03:00 PDT 2018


Holger, Andreas, files converted JSON -> XML in Chrome and Firefox have CDATA sections, but Edge doesn’t have CDATA sections when looking at serialized XML text, from my several time look.   We need a better hack below in X3DJSONLD for Edge, I think, but investigate below:

function CDATACreateFunction(document, element, str) {
        var y = str.replace(/\\"/g, "\\\"")
                .replace(/</g, "<")
                .replace(/>/g, ">")
                .replace(/&/g, "&");
        do {
                str = y;
                y = str.replace(/'([^'\r\n]*)\n([^']*)'/g, "'$1\\n$2'");
                if (str !== y) {
                        // console.error("CDATA Replacing",str,"with",y);
                }
        } while (y != str);
        var domParser = new DOMParser();
        var cdataStr = '<script> <![CDATA[ ' + y + ' ]]> </script>'; // has to be wrapped into an element
        var scriptDoc = domParser .parseFromString (cdataStr, 'application/xml');
        var cdata = scriptDoc .children[0] .childNodes[1]; // space after script is childNode[0]
        element .appendChild(cdata);
}


Holger, there may be an issue with:

	browser.replaceWorld(browser.createX3DFromString(content));  // where content is XML

in the Edge browser for X_ITE.  No problems with Chrome or Firefox in that regard.

This is with 4.1.5.

You can see it online here:  https://coderextreme.net/X3DJSONLD/src/main/html/index.html

Select ../data/flowers2.json from the upper left selection (this is converted to XML (not DOM, although I could) and loaded into X_ITE).  If you paste flowers2.x3d into the XML section, you might see that the flowers aren’t colored, but black and white for some reason (PROTOs?).  Note that you may have to reload because failed replaceWorlds will freeze the canvas, I think.

Also ../data/force.json has no animation with Edge and the XML version.  I feel this may be the CDATA above, but it also may be due to an initializeOnly field on an Extrusion (spine).

These errors may be due to initializeOnly fields (modifying Extrusion spline, IFS coordIndexes) which aren’t tested with browser.importJS??? (not sure—may want to check).  Note that X3DJSAIL does not validate flowers2.json (converted to flowers2.java), so likely there’s an issue with that file.  I’m also getting XML5656: Illegal qualified name character. And [object Error]: {description: "Unable to get property 'setup' of undefined or null reference", message: "Unable to get property 'setup' of undefined or null reference", number: -2146823281, stack: "TypeError: Unable to get property 'setup' of undefined or null reference at createX3DFromString (https://cdn.rawgit.com/create3000/x_ite/4.1.5/dist/x_ite.min.js:43:22971) at Anonymous function (http://localhost:3000/node/loaderJQuery.js:204:3) at h (https://cdn.rawgit.com/create3000/x_ite/4.1.5/dist/x_ite.min.js:4:24940) at c.add (https://cdn.rawgit.com/create3000/x_ite/4.1.5/dist/x_ite.min.js:4:25057) at T (https://cdn.rawgit.com/create3000/x_ite/4.1.5/dist/x_ite.min.js:43:29332) at t (https://cdn.rawgit.com/create3000/x_ite/4.1.5/dist/x_ite.min.js:43:30467) at load_X_ITE_XML (http://localhost:3000/node/loaderJQuery.js:202:2) at loadXmlBrowsers (http://localhost:3000/node/loaderJQuery.js:80:4) at Anonymous function (http://localhost:3000/node/loaderJQuery.js:290:8) at Anonymous function (http://localhost:3000/node/loaderJQuery.js:438:3)"}

Again, all this is working fine in Chrome and Firefox as far as I know.  Well X3DOM isn’t currently working in Chrome. Sigh!

Thanks,

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180331/9e9f4033/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: force.x3d
Type: application/octet-stream
Size: 8931 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180331/9e9f4033/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flowers2.x3d
Type: application/octet-stream
Size: 6142 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180331/9e9f4033/attachment-0003.obj>


More information about the x3d-public mailing list