[x3d-public] agreement on number of \\\\\\\\ in Java???? X3DJSAIL.

Don Brutzman brutzman at nps.edu
Thu Jul 27 23:59:22 PDT 2017


[double vision! nnoo rreeaallyy!!]

On 7/27/2017 9:11 PM, John Carlson wrote:
> Don, can we get some agreement on the number of \\\\\ in Java or provide alternate paths?

Well, in general... For a Java String, \ is escape character.  Thus \\ needed to produce a \ character in memory when defining a Java String.

Am expecting that \\ in a Java String produces a \ in a memory string (i.e. what gets displayed visually by X3D scene), which in turn can also be defined by \\ in a file encoding string (ClassicVRML, VRML97, XML, JSON).

Rephrase: Java, JSON, XML ClassicVRML, and VRML97 constructs all look similar because \ is escape character, and \\ escapes the backslash character, which produces \ in memory and in display.

Hope that this makes sense.  If X3DJSAIL output serialization is incorrect, I will fix... but sorry, am not sure when I can next test, SIGGRAPH is upon us!  Will check further when possible.

Thanks for drilling down on this important point John.


> Please test this Java on your system (I have a different X3DJSAIL version), and let me know if the JSON output is right or not (matches text.json). I provide input XML, input JSON, Java and output JSON. Also compare intermediate XML to input XML.
> 
> My JSON output is in text.new.json, and as you can see, it is not right.
> 
> Also note that “\\\\\\” got replaced with “ \\\” (leading space before \)
> 
> If I need to update my X3DJSAIL, let me know.  Thanks!
> 
> Also see if my translation from JSON to Java is correct. Thanks!
> 
> 
> Right now my DOM dump looks bad, but I will test in the GUI eventually.
> 
> I think you’re going to tell me my Java is bad, then we can discuss.
> 
> In general, my JSON looks like my Java, so:
> 
> "@string":["Node2","\\","\\\\","\\\\\\","Node2"],
> 
> maps to:
> 
> return new MFStringObject(new java.lang.String[] {"Node2","\\","\\\\","\\\\\\","Node2"});
> 
> If this is not totally reasonable, and acceptable to SAI, let me know.
> 
> John


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list