[x3d-public] X3DJSAIL:Interestingexception, but...tableforstringconversionexamples

John Carlson yottzumm at gmail.com
Wed May 24 20:45:51 PDT 2017


How should \n be handled in Java? Here is the code:

        .addMeta(new metaObject().setName("description").setContent("a script test with embedded \n between single quotes")))

In the intermediate XML, this get put out as:
        <meta name='description' content='a script test with embedded
 between single quotes' dir='' http_equiv='' lang='' scheme=''/>

I guess in Java, \n means something, so we need to \\ it in the Java.  Hmm.

John
Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 11:38 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE:X3DJSAIL:Interestingexception,but...tableforstringconversionexamples

The \’ in XML Scripts has been resolved.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 11:10 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE:X3DJSAIL:Interestingexception,but...tableforstringconversionexamples

Here is my JavaScript for the previous case.  Please let me know if the \’ is the right thing to do, or if I need more \.  I think I may need one more.  Hmm.  Same with the Java.  Hmm.   I’m also still experiencing problems with the pi entity in the intermediate XML and output JSON from JSON…wrong character gets output—not the entity in XML.  XML JavaScript output has the codepoint, and not the entity.

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 10:33 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL:Interestingexception,but...tableforstringconversionexamples

More issues with scripts.

Backslashed \’ gets the \ taken out.  There’s also an entity issue.  Not sure where that came from.  It’s in the intermediate XML and the output JSON, but not in the Java or Nashorn XML output or JavaScript (not included).  All my XML output comes from Nashorn, and the Serializer is very slightly different, doing a  replace(/\\\\"/g, '\\\"') in MFStrings.  That probably isn’t right, and I don’t test the JavaScript too much, but it may affect my XML output, FYI.  Not that I report much on XML output beside intermediate output.  I will watch for differences.

See attached data and Java and diffs.

diff is between CameraPrototypes.x3d and CameraPrototypes.new.json.intermediate.x3d
[ not complete ]

There’s also an issue with my serialized DOM from JSON, changing the script to add end tags in the script, but I won’t reveal that.  Whoops.  Hmm.  I am not sure if that is a good idea or not.  I will have to think on it some…

John

See original JSON, Original XML, Intermediate XML

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 9:33 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL: Interestingexception,but...tableforstringconversionexamples

Note red below.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 8:39 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL: Interesting exception,but...tableforstringconversionexamples

The problem with the script appears to be a problem with X3dToJson.xslt.  JSON attached.  See previous message for XML.  Note that the \” that appears in the script in the XML is not \\\” in the JSON.  This I believe is the MFString in a Script problem I mentioned before. I am not sure if this should be fixed.

I am not changing my serializers yet.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 8:24 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL: Interesting exception, but...tableforstringconversionexamples

Perhaps I spoke too soon.  Look at this Java code, original XML and Intermediate XML output and final X3d output.  Particularly, look at the Java code and original XML to see if you can see any problems with it (I believe if there are problems, we will have to document how to program Java for X3DJSAIL-there is a problem with the script I see—I will try to change my serializer, mentioned before I think).  Then fully compare the areas of controversy in the text.x3d with the output XML to see how they differ.

This should be output from original X3DJSAIL, but please by all means run the java against your code base.

Also, once patches are in place, retest X3dToJava.xslt.

Thanks,

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 7:53 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL: Interesting exception, but ...tableforstringconversionexamples

That was the original X3D XML, not the output from X3DJSAIL.  Run the program to get the output.

I think X3DJSAIL will be in pretty good shape for release once we get this patch in.
We will have to retest X3dToJava.xslt though I think, unfortunately.

John
Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 7:45 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL: Interesting exception, but ... tableforstringconversionexamples

As you can see from the original X3DJSAIL output from my code, it does need to be patched for MFString String arrays.  I recommend patching X3DJSAIL until my code produces the right output for MFString String arrays.  Then we will handle the other things as they appear.  Here is my code and XML again for testing.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 7:20 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL: Interesting exception, but ... tableforstringconversion examples

Okay, here is the original X3DJSAIL output from your and my programs:



Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 7:10 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: RE: X3DJSAIL: Interesting exception, but ... table forstringconversion examples

Okay, with my patches.  Here the X3D, your and my code (same filename), and the output X3D.

I will report without patches later.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Wednesday, May 24, 2017 2:13 PM
To: Don Brutzman
Subject: Re: X3DJSAIL: Interesting exception, but ... table for stringconversion examples

I believe the reason you cannot see the problem is because you do not use arrays for MFStrings in your app code (try with both one and two SFStrings, and a quote in the SFstring at the end).

But I could be wrong. Will try to diagnose later.

John

On May 24, 2017 12:59 PM, "John Carlson" <yottzumm at gmail.com> wrote:
The only part I see left is getting the end part of an MFString correct in all cases in XML generation, both in your code and my code. but there's probably more out there.   I recall there being a problem with MFStrings in Scripts as well, but the code was equivalent, so I left it alone.

On May 24, 2017 10:22 AM, "Don Brutzman" <brutzman at nps.edu> wrote:
OK John, thanks for persisting on this one!  Agreed very important... am thinking/hoping I finally understand the mismatch.

Conceptual error: the excess backslashes come from incorrectly trying to represent the XML value in the Java and JSON, rather than trying to represent the in-memory string array that is needed in the Java and JSON.

Possible root cause: specification -> XML -> Xpath -> XSLT -> recursion <- recursion -> .java/.json dizziness!

Email text/html awkwardness coupled with escaping of escaping of escaping hasn't helped us either.

How to regain clarity... let's build an HTML table that compares equivalences for

- value
- rendering
- XML .x3d
- ClassicVRML
- JSON
- Java

Putting it on an HTML table will help us avoid email twists that occur with reply indenting, mailer issues etc.

If the result makes sense, it will help us "zero in" on specific conversion pairs that are questionable.  If it works, will probably be useful for X3D Scene Authoring Hints.

More to follow in the next day or so...  once we get clear on each curious case, calibrating the stylesheet converters will be straightforward at this point.

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











-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170524/9a58e15c/attachment-0001.html>


More information about the x3d-public mailing list