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

John Carlson yottzumm at gmail.com
Sun Dec 17 03:45:20 PST 2017


Output from first Java, JSON is:

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

So it’s missing the space and has extra \’s in the second string.

Conversion of first Java to XML:

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

So extra \’s and missing space.

First Java:

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

Sent from Mail for Windows 10

From: John Carlson
Sent: Sunday, December 17, 2017 5:38 AM
To: x3d-public at web3d.org; Don Brutzman; Roy Walmsley
Subject: Conversions: What should the MFString encodings be??? It looks likeonly the original and X3dToJava.xslt is correct! X3dToJson.xslt andX3DJSAIL.

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/c6fcf555/attachment.html>


More information about the x3d-public mailing list