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

John Carlson yottzumm at gmail.com
Sun Apr 1 02:04:09 PDT 2018


More info.  When I load flowers2.x3d XML without converted JSON -> XML (comment out call to updateFromJson()).   

1. XML Parser Error: Couldn't create IS reference: Field 'diffuseColor' and 'diffuseColor' in PROTO have different types.
x_ite.min.js (17,13252)
2. XML Parser Error: Couldn't create IS reference: Field 'specularColor' and 'specularColor' in PROTO have different types.
x_ite.min.js (17,13252)
3. XML Parser Error: Unknown named or imported node 'Clock'.
x_ite.min.js (17,15070)
4. XML Parser Error: Unknown named or imported node 'OrbitPath'.
The display comes up in X_ITE XML with no color and no animation.

So likely there’s a problem with my XML and CDATA.  But I think the JSON may be okay (the conversion from JSON -> XML), at least for JSON parsing and X3DOM.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Saturday, March 31, 2018 4:02 PM
To: holger.seelig at yahoo.de; x3d-public at web3d.org; Andreas Plesch
Subject: possible issue with X_ITE with Edge; CDATA sections not showing up inEdge XML textareas.

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/20180401/052b4c37/attachment-0001.html>


More information about the x3d-public mailing list