[x3d-public] X3D Scene Authoring Hints Strings table, plus X3DJSAIL improvements for MFString and command-line handling
Don Brutzman
brutzman at nps.edu
Sun May 28 02:42:49 PDT 2017
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
http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#Strings
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.
http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html
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.
http://www.web3d.org/specifications/java/X3DJSAIL.html#Examples
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:
X3DObject
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3DObject.html#method.summary
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.
Example:
/** Default main() method provided for test purposes.
* @param argv input parameters
*/
public static void main(String argv[])
{
X3DObject exampleObject = new StringArrayEncodingExamples().getX3dModel();
exampleObject.handleArguments(argv);
System.out.print("StringArrayEncodingExamples execution self-validation test results: ");
String validationResults = exampleObject.validationReport();
System.out.println(validationResults);
}
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
More information about the x3d-public
mailing list