<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Holger, this message ended up in my spam folder, but I happened to see it.</div><div dir="ltr"><br></div><div>Don has announced that many MFStrings should be arrays in JSON, but he has not spoken yet about NavigationInfo@type, he's pointed at web pages, but that's kind of empty, see further below.</div><div dir="ltr"><br></div><div>I found this fix to X3DJSONLD.java useful, but I'm converting to DOM/XML from JSON:</div><div><br></div><div><div> public String NavigationInfoTypeToXML(String str) {</div><div> String y = str;</div><div> System.err.println("X3DJSONLD jsonstring replacing "+ y);</div><div> str = y.replaceAll("\\\\", "");</div><div> if (!y.equals(str)) {</div><div> System.err.println("with "+ str);</div><div> } else {</div><div> System.err.println("ok");</div><div> }</div><div> return str;</div><div> }</div></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"> } else if (ok instanceof JsonString) {</div><div dir="ltr"> if (key.equals("#comment")) {</div><div dir="ltr"> Comment comment = document.createComment(CommentStringToXML(ok.toString()));</div><div dir="ltr"> child.appendChild(comment);</div><div dir="ltr"> } else if (key.equals("@type") && parentkey.equals("NavigationInfo")) {</div><div dir="ltr"> elementSetAttribute(child, key.substring(1), NavigationInfoTypeToXML(ok.toString()));</div><div dir="ltr"> } else {</div><div dir="ltr"> // ordinary string attributes</div><div dir="ltr"> elementSetAttribute(child, key.substring(1), ok.toString());</div><div dir="ltr"> }</div><div dir="ltr">===============================================================</div><div>I don't see a problem with X3DJSONLD.js DOM XML dump output. See X3DJSONLD/src/main/data/*.x3d.new</div><div><br></div><div><br></div></div><div dir="ltr">===============================================================<br><div><br></div><div>The pages Don listed recently showed NavigationInfo@type as an array, see:</div><div><br></div><div><a href="https://www.web3d.org/x3d/stylesheets/X3dToJson.html">X3D to JSON Stylesheet Converter (web3d.org)</a></div><div><br></div><div>(Search for NavigationInfo)</div><div><br></div><div>But whether X3dToJson.xslt actually follows these rules, I would say, "No!" But I didn't download the stylesheet from the website!</div><div><br></div><div>Here are the difference in my current copy, local, then the web version:</div><div><br></div><div><div>$ diff X3dToJson.xslt ~/Downloads/X3dToJson\ \(3\).xslt</div><div>3068c3068</div><div>< not((local-name()='containerField' and string(.)='texture') and (local-name(..)='ImageTexture' or local-name(..)='PixelTexture' or local-name(..)='MovieTexture' or local-name(..)='MultiTexture' or local-name(..)='ComposedTexture3D' or local-name(..)='ImageTexture3D' or local-name(..)='PixelTexture3D' or local-name(..)='GeneratedCubeMapTexture')) and</div><div>---</div><div>> not((local-name()='containerField' and string(.)='texture') and (local-name(..)='ImageTexture' or local-name(..)='PixelTexture' or local-name(..)='MovieTexture' or local-name(..)='MultiTexture' or local-name(..)='ComposedTexture3D' or local-name(..)='ImageTexture3D' or local-name(..)='PixelTexture3D')) and</div></div><div><br></div><div>Here's a recently converted file:</div><div><br></div><div><div>-rw-r--r-- 1 john 197609 14887 Sep 15 00:15 ball.json</div><div>-rw-r--r-- 1 john 197609 7774 Sep 15 00:15 ball.x3d</div><div><br></div><div>$ grep XAMINE ball.json</div><div> "@type":"\"ANY\" \"EXAMINE\" \"FLY\" \"LOOKAT\""</div></div><div><br></div><div>Apparently, X3dToJson.xslt is not following what's announced on the web pages. No, I'm not going to take a snapshot.</div><div><br></div><div><div>$ diff X3dToJson.xslt /c/x3d-code/<a href="http://www.web3d.org/x3d/stylesheets/X3dToJson.xslt">www.web3d.org/x3d/stylesheets/X3dToJson.xslt</a></div><div><br></div><div>$ ls -l X3dToJson.xslt /c/x3d-code/<a href="http://www.web3d.org/x3d/stylesheets/X3dToJson.xslt">www.web3d.org/x3d/stylesheets/X3dToJson.xslt</a></div><div>-rw-r--r-- 1 john 197609 313307 Sep 14 11:52 /c/x3d-code/<a href="http://www.web3d.org/x3d/stylesheets/X3dToJson.xslt">www.web3d.org/x3d/stylesheets/X3dToJson.xslt</a></div><div>-rw-r--r-- 1 john 197609 313307 Sep 14 11:52 X3dToJson.xslt</div></div><div><br></div><div>John<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">Holger Seelig</strong> <span dir="auto"><<a href="mailto:holger.seelig@yahoo.de">holger.seelig@yahoo.de</a>></span><br>Date: Mon, Aug 28, 2023 at 9:38 AM<br>Subject: [x3d-public] Encoding of MFString fields in JSON (.x3dj)<br>To: X3D <<a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>><br></div><br><br><div><div>There is currently an open issue about JSON encoding of MFString fields, especially the NavigationInfo.type field: <a>https://github.com/create3000/x_ite/issues/146</a></div><div><br></div><div>All MFString fields should be encoded the same way: as you can see in <a>https://www.web3d.org/x3d/content/examples/ConformanceNist/BindableNodes/NavigationInfo/speed_scaling.json</a></div><div>ImageTexture and Script.url fields are encoded as JSON Array of Strings, but <span style="color:rgb(0,0,0);white-space:pre-wrap">NavigationInfo.type is encoded as simple string with strange contents: </span><a>https://www.web3d.org/x3d/content/examples/ConformanceNist/BindableNodes/NavigationInfo/any_type.json</a><span style="color:rgb(0,0,0);white-space:pre-wrap">.</span></div><div><br></div><div>No professional programmer would seriously use another encoding for NavigationInfo.type, then the other MFString values have. The encoding used for NavigationInfo.type is only useful if you are going to convert the JSON to XML, which is probably not what you want when you parse a JSON. An Array of String follows the same encoding scheme as the other types like MFInt32 (Array of Integers), which is very convenient.</div><div><br></div><div>I don't really like to change anything about the encoding of JSON in X_ITE.</div><div><br></div><div>Best regards,</div><div>Holger</div><div><br></div><div>
<div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="auto" style="text-align:start;text-indent:0px"><div style="color:rgb(0,0,0);letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">--</div><div style="color:rgb(0,0,0);letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Holger Seelig</div><div style="color:rgb(0,0,0);letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Leipzig, Germany</div><div style="color:rgb(0,0,0);letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div><div style="color:rgb(0,0,0);letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><a>holger.seelig@yahoo.de</a></div><div><a>https://create3000.github.io/x_ite/</a></div></div></div></div></div></div></div>
</div>
<br></div>_______________________________________________<br>
x3d-public mailing list<br>
<a>x3d-public@web3d.org</a><br>
<a rel="noreferrer">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</div></div></div></div></div></div></div></div></div>