[x3d-public] Conversions: What should the MFString encodings be??? It looks like only the original and X3dToJava.xslt is correct! X3dToJson.xslt and X3DJSAIL.

John Carlson yottzumm at gmail.com
Sun Dec 17 02:38:59 PST 2017


The other examples rely on X3dToJson.xslt, so it needs to be fixed to leave the space in, and holymoly, not put so many \ in when running from X3DJSAIL to JSON, and not remove \ when running from X3DJSAIL to XML. Second Java, JavaScript and Python versions derive from DOM.  Note the differences between the two Javas.  I think both need to be handled.

Fix the space first, and we will revisit I guess.  I believe both Java encodings need to be handled in X3DJSAIL, possibly with an MFStringObject constructor change.

Original X3D:

<Text string='"Node3 \\\\ \\ " "Node3\"\"\""'>

Java (Output from X3dToJava.xslt)

.setGeometry(new TextObject().setString(new MFStringObject("\"Node3 \\\\\\\\ \\\\ \" \"Node3\\\"\\\"\\\"\""))

JSON (Output from X3dToJson.xslt) – missing space between \ and "

"@string":["Node3 \\\\ \\","Node3\"\"\""],

Java (Output from JavaSerializer.js, input is JSON via DOM) – missing same space that JSON misses

return new MFStringObject(new java.lang.String[] {"Node3 \\\\ \\","Node3\"\"\""});

JSON (Output from second Java, X3DJSAIL) – holy moly!

"Node3 \\\\\\\\\\\\\\\\ \\\\\\",
"Node3\\\"\\\"\\\""

X3D (output from Nashorn, X3DJSAIL):

<Text string='"Node3 \\ \" "Node3\"\"\""'>

Nashorn (Output from JavaScriptSerializer.js):

            .setGeometry(new TextObject().setString(Java.to(["Node3 \\\\ \\","Node3\"\"\""], Java.type("java.lang.String[]")))

Intermediate X3D (Output from second Java I think, X3DJSAIL):

<Text length='' maxExtent='0.0' solid='false' string='"Node3 \\ \" "Node3\"\"\""' class=''>

Intermediate DOM (Output from DOMSerializer):

<Shape><Text containerField="geometry" string=""Node3 \\\\ \\" "Node3\"\"\"""><FontStyle containerField="fontStyle"></FontStyle>

Python (Output from PythonSerializer):

Text21.setString(["Node3 \\\\ \\","Node3\"\"\""])


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


More information about the x3d-public mailing list