[x3d-public] X3DJSAIL app. Java SAI questions on MFStringObject, Π with String array initializer

John Carlson yottzumm at gmail.com
Thu Sep 28 21:18:41 PDT 2017


How are \\\\ (double backslash) and Π (Π) supposed to be used in a MFStringObject with String array initialization in Java?   Run this java program to get output JSON, then investigate the characters.
In Java, they appear on line 121, attached.

It looks like \\\\ goes to \\ in JSON, when it should go to \\\\
And Π goes to Π(two characters)

X3dToJson.xlst produces this:

                    "@string":["Character entity substitutions:","empty string \"\" skips a line:","","apostrophe ' is '","ampersand & is &","quote mark \" is "","backslash \\ is X3D escape character","double backslash \\\\ is X3D backslash \\ character","Pi Π is Π XML character entity"],

--------------------------------------------------------------------------------------------------------------------------------------------------------------
Note that this in Java (but why are there two MFStringObjects???—generated from X3dToJava.xslt):

        private MFStringObject DefaultText_4_15_string = new MFStringObject(new MFStringObject("\"Character entity substitutions:\"         \"empty string \\\"\\\" skips a line:\"         \"\"         \"apostrophe  '  is '\"          \"ampersand & is &\"         \"quote mark  \\\"  is "\"         \"backslash \\\\ is X3D escape character\"         \"double backslash \\\\\\\\ is X3D backslash \\\\ character\"         \"Pi Π is Π XML character entity\""));

Produces this:

"@string":["Character entity substitutions:\" \"empty string \\"\\" skips a line:\"
\"\" \"apostrophe ' is '\" \"ampersand & is &\" \"quote mark \\" is "\"
\"backslash \\ is X3D escape character\" \"double backslash \\\\ is X3D backslash
\\ character\" \"Pi Π is Π XML character entity"],
---------------------------------------------------------------------------------------------------------------------------------------------------------------
But I would like to use this, as it makes a lot more sense to me:

    return new MFStringObject(new java.lang.String[] {"Character entity substitutions:","empty string \"\" skips a line:","","apostrophe ' is '","ampersand & is &","quote mark \" is "","backslash \\ is X3D escape character","double backslash \\\\ is X3D backslash \\ character","Pi Π is Π XML character entity"});

Produces this:

                    "@string":["Character entity substitutions:","empty string \"\" skips a line:","","apostrophe ' is '","ampersand & is &","quote mark \" is "","backslash \\ is X3D escape character","double backslash \\ is X3D backslash \\ character","Pi Π is Π XML character entity"],

---------------------------------------------------------------------------------------------------------------------------------------------------------------
What does the SAI standard say? Does X3DJSAIL conform to the standard? What does the X3D JSON say for MFStrings?    What happens when we convert the new JSON to Java?   Shouldn’t the output of X3DJSAIL be similar to X3dToJson.xslt?

Thanks,

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170929/a47acf03/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TextSpecialCharacters.new.json
Type: application/json
Size: 4746 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170929/a47acf03/attachment-0001.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TextSpecialCharacters.newPrettyPrint.intermediate.x3d
Type: application/octet-stream
Size: 3807 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170929/a47acf03/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TextSpecialCharacters.x3d
Type: application/octet-stream
Size: 2707 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170929/a47acf03/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TextSpecialCharacters.java
Type: application/octet-stream
Size: 7101 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170929/a47acf03/attachment-0005.obj>


More information about the x3d-public mailing list