[x3d-public] X3D Scene Authoring Hints Strings table, plus X3DJSAIL improvementsfor MFString and command-line handling

John Carlson yottzumm at gmail.com
Sun May 28 19:50:01 PDT 2017

As far as I can tell, handleArguments does not handle JSON output.  I will try x3d.  Also, one should loop through the arguments, so one can have multiple outputs.

A help string like

[ [ -x3d | -java | -vrml | -validate] [ filename ]] …

Might work better with a default filename and  a default converter.


Sent from Mail for Windows 10

From: Don Brutzman
Sent: Sunday, May 28, 2017 5:43 AM
To: John Carlson; X3D Graphics public mailing list
Subject: X3D Scene Authoring Hints Strings table, plus X3DJSAIL improvementsfor MFString and command-line handling

OK more progress today.  (Am starting a new thread since a number of changes have been applied that relate to many threads.)

1.  First, added a table comparing MFString representations for multivarious file encodings and programming languages.

	X3D Scene Authoring Hints, Strings: SFString/MFString Encodings

This should make it easier to compare and comment and make corrections, less whipsawing from email and reply twists/turns.
Example excerpts:

actual display value

One, Two, Three
He said, "Immel did it!"

XML encoding (.x3d)

string='"One, Two, Three" "" "He said, \"Immel did it!\""'

or else various XML character-entity substitution alternatives such as

string='"One, Two, Three" "" "He said, \"Immel did it!\""'

string=""One, Two, Three" "" "He said, \"Immel did it!\"""

ClassicVRML encoding (.x3dv)

string [ "One, Two, Three", "", "He said, \"Immel did it!\"" ]

VRML97 (.wrl)

string [ "One, Two, Three", "", "He said, \"Immel did it!\"" ]

JSON encoding (.json)

"@string": [ "One, Two, Three", "", "He said, \"Immel did it!\"" ]

X3DJSAIL (.java)

.setString(new String [] {"One, Two, Three", "", "He said, \"Immel did it!\""})

.setString(new MFStringObject(new String [] {"One, Two, Three", "", "He said, \"Immel did it!\""}))

.setString(new MFStringObject("\"One, Two, Three\" \"\" \"He said, \\\"Immel did it!\\\"\"")) 	


Will add more to this section, for example common character-entity substitutions.  Review comments welcome.

2.  Added a dedicated scene to test quotation mark escaping, adapting the Immel examples in various specifications.


3.  Copied the gnarly example Text node from that scene into HelloWorldProgram.java smoke test, also including a few Java variations.

Took some debugging, now seems to work for various conversions to .x3d .json .x3dv .wrl etc.


John if you look closely in there, all three forms are compiling OK.  I tested several times so that each got exercised.

Looks like they work OK.  Motivation: supporting multiple approaches provides programmer flexibility so that more than one style can work OK.

4.  Consolidated autogenerated source code per your suggestion John, adding two utility methods to X3DObject:


  	String handleArguments(java.lang.String[] argv)
	Utility method for standalone programs that get created with X3dToJava.xslt stylesheet.
	Invocation switches: -help -validate -x3d -x3dv -vrml -json -html -x3dom -cobweb [filename]

	String validationReport()
	Provide thorough X3DJSAIL validation results for this X3D model.


/** Default main() method provided for test purposes.
  * @param argv input parameters
public static void main(String argv[])
	X3DObject exampleObject = new StringArrayEncodingExamples().getX3dModel();

	System.out.print("StringArrayEncodingExamples execution self-validation test results: ");
	String validationResults = exampleObject.validationReport();

Haven't really tested handleArguments yet, so fire away!

5.  Am rerunning all java conversions using X3dToJava.xslt stylesheet tonight to take advantage of main() optimizations and some \" string tweaks.  Will upload when complete.

Song of the day:  "Best of Both Worlds" by Van Hagar.  8)

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/20170528/e1bfd2ec/attachment.html>

More information about the x3d-public mailing list