[x3d-public] Anxious to get MFStrings with commas as whitespace handled

Don Brutzman brutzman at nps.edu
Sun May 28 16:29:30 PDT 2017


OK fixed problem with X3dToJson.xslt stylesheet mistaken escaping if intermediate "," delimiters.

Continuing with modified test scene

	http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html

to include commas between MFString elements:

<Shape>
   <Text string='"One, Two, Three","","He said, \"Immel did it!\""'>
     <FontStyle justify='"MIDDLE","MIDDLE"' style='BOLD'/>
   </Text>
   <Appearance>
     <Material diffuseColor='0.6 0.4 0.2'/>
   </Appearance>
</Shape>

resulting in

{ "Text":
   {
	"@string":["One, Two, Three","","He said, \"Immel did it!\""],
	"-fontStyle":
	  { "FontStyle":
		{
		  "@justify":["MIDDLE","MIDDLE"],
		  "@style":"BOLD"
		}
	  }
   }
},

note corrected "@justify":["MIDDLE","MIDDLE"],

Checked in.  Redeploying X3DJSAIL and regression testing all .json examples (though few are expected to be affected because there are few such examples).  Also redeploying X3DJSAIL to match.


On 5/28/2017 3:06 PM, Don Brutzman wrote:
> cc: group
> 
> On 5/25/2017 3:02 PM, John Carlson wrote:
>> Don,
>>
>> I’m kind of anxious to get MFStrings with commas as whitespace between SFStrings handled in X3dToJson.xslt.  Maybe make that your first priority when you get some time, because it will likely impact others using X3dToJson.xslt and testing X3DJSON.  Thanks!
> 
> ok, tried to understand this issue.  problem isolation follows.  this didn't come up for me earlier because typically the example archives don't use commas as whitespace.
> 
> am working with test scene at
> 
> http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html
> 
> The following seemed to convert OK with commas inserted, but then saw the problem:
> 
> <Shape>
>    <Text string='"One, Two, Three","","He said, \"Immel did it!\""'>
>      <FontStyle justify='"MIDDLE","MIDDLE"' style='BOLD'/>
>    </Text>
>    <Appearance>
>      <Material diffuseColor='0.6 0.4 0.2'/>
>    </Appearance>
> </Shape>
> 
> { "Shape":
>    {
>      "-geometry":
>        { "Text":
>          {
>            "@string":["One, Two, Three\",\"\",\"He said, \"Immel did it!\""],
>            "-fontStyle":
>              { "FontStyle":
>                {
>                  "@justify":["MIDDLE\",\"MIDDLE"],
>                  "@style":"BOLD"
>                }
>              }
>          }
>        },
> 
> conversion console log follows.
> 
> ========================================================================================================
> processScenes.json:
> stylesheet compiled=false
> C:\x3d-code\www.web3d.org\x3d\content\examples\Basic/X3dSpecifications//StringArrayEncodingExamples.x3d processing with X3dToJson stylesheet
> C:\x3d-code\www.web3d.org\x3d\content\examples\Basic/X3dSpecifications//StringArrayEncodingExamples.json validation checking with jslint
> C:\x3d-code\www.web3d.org\x3d\content\examples\Basic/X3dSpecifications//StringArrayEncodingExamples.json validation checking with json-schema-validator
> --- BEGIN C:\x3d-code\www.web3d.org\x3d\content\examples\Basic\X3dSpecifications\StringArrayEncodingExamples.json---
> validation: FAILURE
> [ {
>    "level" : "error",
>    "schema" : {
>      "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",
>      "pointer" : "/definitions/@justify/items/0"
>    },
>    "instance" : {
>      "pointer" : "/X3D/Scene/-children/2/Shape/-geometry/Text/-fontStyle/FontStyle/@justify/0"
>    },
>    "domain" : "validation",
>    "keyword" : "enum",
>    "message" : "instance value (\"MIDDLE\\\",\\\"MIDDLE\") not found in enum (possible values: [\"BEGIN\",\"END\",\"FIRST\",\"MIDDLE\",\"\"])",
>    "value" : "MIDDLE\",\"MIDDLE",
>    "enum" : [ "BEGIN", "END", "FIRST", "MIDDLE", "" ]
> } ]
> --- END C:\x3d-code\www.web3d.org\x3d\content\examples\Basic\X3dSpecifications\StringArrayEncodingExamples.json---
> ========================================================================================================
> 
> I think the json schema is telling us that this is the JSON-output culprit:
> 
>      "@justify":["MIDDLE\",\"MIDDLE"],
> 
> specifically
> 
>      "MIDDLE\",\"MIDDLE"
> 
> the value should be unescaped in the middle, instead appearing as
> 
>      "MIDDLE","MIDDLE"
> 
> ... thanks for continued testing, i'll work on this case next.
> 
>> Holger, you could also change your examples to use a space and not a comma.  Thanks!
>>
>> Right now, it’s \"ing the interior "’s
> am working to make things handle all legal syntax.  so no adjustment of legal content is desired, that will just hide problems.
> 
> all the best, Don


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