[x3d-public] per X3D working group phone call Friday, what to do with " at beginning and ending of attribute value?

John Carlson yottzumm at gmail.com
Wed Apr 7 13:58:02 PDT 2021


Don,  this stripQuotes for setting attributes may need to be addressed per
result’s of Vince’s discussion Friday.   StripQuotes is in X3DJSONLD.java
(you’ve probably renamed it by now).

Thanks for taking my code under the X3DJSAIL wing, I don’t know if I’ll be
able to contribute through svn until I get a new account.   If you feel a
new account is urgent, I will up the priority.

Sigh!

On Sat, Apr 3, 2021 at 4:49 PM John Carlson <yottzumm at gmail.com> wrote:

> Vince mentioned '"radius"' in phone call Friday as a valid XML
> SFString.   So perhaps I shouldn't strip matching bounding quotes off
> when converting to a DOM structure?
>
> This affects X3DJSONLD.java. I don't think I've coded this into any
> JavaScript at this point. X3DJSONLD.cpp also has issues. (Are there
> users of X3DJSONLD in Java and C++?)
>
> It was kind of a serendipitous find (and amazing that i was on the phone
> call at all)...There are 4 other uses in X3DJSONLD.java that need to be
> investigated.
>
> Thank Don, for pushing me to have a working JSON loader in X3DJSAIL.  If
> Don doesn't go ahead an program loading X3D JSON into X3DJSAIL
> (X3DJSONLD.java's currently in the net.coderextreme package).
>
> I am sorry I have had other pursuits, and have not been spending time on
> JSON.  I agree that this is my primary volunteer responsibility.   I
> will look into issues, if any, on GitHub. Has someone posted an issue on
> github under X3DJSONLD? I don't see any. I just added one.
>
> I wouldn't call either X3DJSONLD.java or X3DJSONLD.cpp sufficiently
> tested, at least beyond Don's X3DJSAIL HelloWorld examples.   Real world
> struggles and stories are welcome.
>
>  From X3DJSONLD.java:
>
>     public String stripQuotes(String value) {
>                  if (value.charAt(0) == '"' &&
> value.charAt(value.length()-1) == '"') {
>                          return value.substring(1, value.length()-1);
>                  } else {
>                          return value;
>                  }
>          }
>          public void elementSetAttribute(Element element, String key,
> String value) {
>                  if (key.equals("SON schema")) {
>                          // JSON Schema
>                  } else if (key.equals("ncoding")) {
>                          // encoding, UTF-8, UTF-16 or UTF-32
>                  } else {
>                          // System.err.println(key+"= SA "+value);
>                          element.setAttribute(key, stripQuotes(value));
>                  }
>          }
>
> The question becomes, why do I have stripQuotes in X3DJSONLD.java and
> X3DJSONLD.cpp?????  Probably the X3DJSAIL version is more tested than
> X3DJSONLD's version of X3DJSONLD.java.
>
>
> Here are primary test cases of X3DJSONLD:
>
>
> /c/x3d-code/www.web3d.org/x3d/stylesheets/java$ grep -l X3DJSONLD
> */examples/*
> nashorn/examples/Java.java
> nashorn/examples/Json.js
> nashorn/examples/Nashorn.js
> nashorn/examples/Node.js
> nashorn/examples/Quotes.js
> node/examples/Java.java
> node/examples/X3Dautoclass.js
>
>
> (I know the names are bad, apologies).
>
>
> Here are examples one might use to test, if you can identify SFStrings:
>
>
> /c/x3d-code/www.web3d.org/x3d/stylesheets/java/examples$ grep -l
> \'\"[^\"]*\"\' *
> CleatClamp.py
> CleatClamp.x3d
> HelloWorldProgram.java
> HelloWorldProgramOutputCanonical.x3d
> HelloWorldProgramOutputCanonical.xml
> HelloWorldProgramOutput_CommandLine.html
> HelloWorldProgramOutput_CommandLineUnzipped.x3d
> HelloWorldProgramOutput_CommandLine.x3d
> HelloWorldProgramOutput_CommandLine.xml
> HelloWorldProgramOutput.html
> HelloWorldProgramOutputLog.txt
> HelloWorldProgramOutput_ReloadedDOM.x3d
> HelloWorldProgramOutputTidy_CommandLine.x3d
> HelloWorldProgramOutputTidy.x3d
> HelloWorldProgramOutput.wrl
> HelloWorldProgramOutput.x3d
> HelloWorldProgramOutput.x3dv
> HelloWorldProgramOutput.xml
>
>
> /c/x3d-code/www.web3d.org/x3d/stylesheets/java/nashorn/examples$ grep -l
> \'\"[^\"]*\"\' *
> HelloWorldProgramOutput.Java.x3d
> HelloWorldProgramOutput.Nashorn.js.newPrettyPrint.intermediate.x3d
> HelloWorldProgramOutput.Nashorn.js.new.x3d
> HelloWorldProgramOutput.x3d
> Java.x3d
> JsonPrettyPrint.intermediate.x3d
> Json.x3d
> Nashorn0.x3d
> NashornPrettyPrint.intermediate.x3d
> Nashorn.x3d
> Node0.x3d
> Node.x3d
> Quotes.x3d
>
> X3d.x3d
>
>
> /c/x3d-code/www.web3d.org/x3d/stylesheets/java/node/examples$ grep -l
> \'\"[^\"]*\"\' *
> HelloWorldProgramOutput.Java.x3d
> HelloWorldProgramOutput.x3d
> Java.x3d
> Json.x3d
> Node0.x3d
> Node.x3d
> Quotes.x3d
> X3d.x3d
>
> It was likely that I was struggling over quoting in the nashorn
> examples, but my memory is pretty much non-existent about this until I
> get back into it.
>
>
> Do people want a typesafe library for loading JavaScript, or something
> more like a DOM-based loader?  I'll make a new message for this.
>
> John
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210407/8881d338/attachment-0001.html>


More information about the x3d-public mailing list