Closed coderextreme closed 2 years ago
To understand any potential issue, more detail or a live example is clearly needed.
I believe this may be an exception caught inside X3DJSONLD and logged. I will try to grab a screenshot of the alert to identify where it’s coming from. In general, probably poke around in https://coderextreme.net/X3DJSONLD/src/main/html/index.html or john.html, but give me more time to research before I waste more of your time.
If you got to index.html in previous paragraph, and select ../data/bubs2.json there is an error alert that may be connected to this, but I think lists a different line number. I am confusing similar errors at this point…please let me research this a bit more. I thought this was going to be a dunk shot. I can probably set a breakpoint before the alert.
non-X3DOM related error possibly. So maybe I can do OCR or investigate logs and code.
There appear to be many issues with this bubs2.json file. I only posted one. All of X3DOM, X_ITE, and X3DJSONLD may be involved. So give me a chance to get to my desktop so I can do more research.
It does sound more like a general DOM/HTML issue.
If you like, I can fix this. #sourceText has become #sourceCode. I think the change to make is in x3dom/src/util/json/JSONParser.js
DOMException: Failed to execute 'createElementNS' on 'Document': The qualified name provided ('#sourceCode') contains the invalid name-start character '#'.
at x3dom.JSONParser.CreateElement (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32178:26)
at x3dom.JSONParser.ConvertObject (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32262:30)
at x3dom.JSONParser.ConvertToX3DOM (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32403:26)
at x3dom.JSONParser.ConvertObject (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32263:22)
at x3dom.JSONParser.ConvertToX3DOM (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32403:26)
at x3dom.JSONParser.ConvertChildren (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32159:22)
at x3dom.JSONParser.ConvertObject (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32231:18)
at x3dom.JSONParser.ConvertToX3DOM (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32403:26)
at x3dom.JSONParser.ConvertObject (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32263:22)
at x3dom.JSONParser.ConvertToX3DOM (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32403:26)
at x3dom.JSONParser.ConvertChildren (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32159:22)
at x3dom.JSONParser.ConvertObject (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32231:18)
at x3dom.JSONParser.ConvertToX3DOM (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32403:26)
at x3dom.JSONParser.ConvertObject (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32263:22)
at x3dom.JSONParser.ConvertToX3DOM (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32403:26)
at x3dom.JSONParser.ConvertToX3DOM (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32380:22)
at x3dom.JSONParser.parseJavaScript (https://www.x3dom.org/download/dev/x3dom-full.debug.js:32110:10)
at x3dom.Runtime.createX3DFromJS (https://www.x3dom.org/download/dev/x3dom-full.debug.js:19949:23)
at eval (webpack://X3DJSONLD/./src/main/node/loaderJQuery.js?:174:28)
at doValidate (webpack://X3DJSONLD/./src/main/node/loadValidate.js?:66:3)
at loadSchema (webpack://X3DJSONLD/./src/main/node/loadValidate.js?:111:8)
at loadX3DJS_X3DOM (webpack://X3DJSONLD/./src/main/node/loaderJQuery.js?:171:2)
at replaceX3DJSON (webpack://X3DJSONLD/./src/main/node/loaderJQuery.js?:354:2)
at loadProtoX3D (webpack://X3DJSONLD/./src/main/node/loaderJQuery.js?:231:5)
at loadX3D (webpack://X3DJSONLD/./src/main/node/loaderJQuery.js?:274:9)
at updateFromJson (webpack://X3DJSONLD/./src/main/node/loaderJQuery.js?:407:3)
at Object.eval [as success] (webpack://X3DJSONLD/./src/main/node/loaderJQuery.js?:491:3)
at c (https://code.jquery.com/jquery-3.6.0.min.js:2:28327)
at Object.fireWith [as resolveWith] (https://code.jquery.com/jquery-3.6.0.min.js:2:29072)
at l (https://code.jquery.com/jquery-3.6.0.min.js:2:79901)
at XMLHttpRequest.
Code to add before #sourceText line includes:
else if ( key === "#sourceCode" )
{
this.CDATACreateFunction( document, element, object[ key ].join( "\r\n" ) + "\r\n" );
}
Should be easy, except for all the GitHub stuff.
Implemented in a branch:
https://github.com/andreasplesch/x3dom/commit/801a996467ce507281a6e5439020b65b346c83c4
Could you please test this build of the test branch: https://61e785e8575a2000099de2a4--x3dom.netlify.app/ ?
Thanks.
Tested https://61e785e8575a2000099de2a4--x3dom.netlify.app/x3dom-full.debug.js
Looks great and bubs2.json is working again! Do you want me to test all versions? I got the one you wanted?
This is one of my successes with scripting an X3D JSON file in X3DOM. Hurrah!
Uncaught DOMException: String contains an invalid character x3dom-full.debug.js:32178