[x3d-public] MFString encoding for \\ for JavaScript SAI in X3DJSAIL?

John Carlson yottzumm at gmail.com
Thu Aug 10 07:35:16 PDT 2017


Original XML:
      <Text DEF='DefaultText' string='"Character entity substitutions:"
        "empty string \"\" skips a line:"
        ""
        "apostrophe  '  is &apos;"
        "ampersand & is &amp;"
        "quote mark  \"  is &quot;"
        "backslash \\ is X3D escape character"
        "double backslash \\\\ is X3D backslash \\ character"
        "Pi Π is &#928; XML character entity"'>
        <FontStyle DEF='CenteredFontStyle' justify='"MIDDLE" "MIDDLE"'/>
      </Text>

My X3DJSAIL JavaScript:
          .setGeometry(new TextObject().setDEF("DefaultText").setString(Java.to(["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"], Java.type("java.lang.String[]")))

Output XML:
            <Text DEF='DefaultText' string='"Character entity substitutions:" "e
mpty string \"\" skips a line:" "" "apostrophe ' is &apos;" "ampersand & is &amp;" "quote mark \" is &quot;" "backslash \ is X3D escape character" "double backslash \\ is X3D backslash \ character" "Pi Π is &#928; XML character entity"'>

Does my JavaScript have the correct number of \\?  What does the JavaScript SAI say? Should we have a Nashorn SAI?

I believe I have an up-to-date version of X3DJSAIL. Is there a runtime way of checking?

JavaScript file included for testing.

Joh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170810/cf7251d9/attachment.html>
-------------- 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/20170810/cf7251d9/attachment.obj>


More information about the x3d-public mailing list