[x3d-public] Rereported problem with X3dToJson.xslt

Don Brutzman brutzman at nps.edu
Wed Jul 26 23:44:08 PDT 2017


On 7/21/2017 9:31 PM, John Carlson wrote:
> See X3D XML and attached (bad) JSON.

thanks.  found loophole, added a case.  stylesheet modification checked in.  test results attached.

	<Text string='"Node2" "\\" "\\\\" "Node2"'>

now translates into JSON as

	"Text":
	{
	   "@string":["Node2","\\","\\\\","Node2"],

> There are a lot of cases to handle I guess.
uh, yup!   :0

for your amusement, debug console for successful test handled by new rule [3.5]
===============================================================================
ant -f C:\\x3d-code\\www.web3d.org\\x3d\\stylesheets test.text
test.mkdir:
test.text:
=====================================
translation input: test/text.x3d
..expected output: test/text.json
[e-q-c-r][1.0][e-q-c-r input][local-name()=profile]Immersive[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=version]3.3[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=noNamespaceSchemaLocation]http://www.web3d.org/specifications/x3d-3.3.xsd[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=name]creator[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=content]John W Carlson[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=name]created[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=content]December 13 2015[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=name]title[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=content]text.x3d[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=name]identifier[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=content]https://coderextreme.net/X3DJSONLD/text.x3d[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=name]description[inputType=SFString]
normalizing: test \n text
[e-q-c-r][9][e-q-c-r input][local-name()=content]test \n text[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=name]generator[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=content]Vim, X3D-Edit, https://savage.nps.edu/X3D-Edit[inputType=SFString]
[e-q-c-r][4.2][e-q-c-r input][local-name()=string]"Node\"\"\""[inputType=MFString]
[e-q-c-r][3.4][e-q-c-r input][local-name()=string]Node\"\"\""[inputType=MFString]
[e-q-c-r][3.4][e-q-c-r input][local-name()=string]\"\""[inputType=MFString]
[e-q-c-r][3.4][e-q-c-r input][local-name()=string]\""[inputType=MFString]
[e-q-c-r][4.0][e-q-c-r input][local-name()=string]"[inputType=MFString]
[e-q-c-r][4.2][e-q-c-r input][local-name()=string]"Node2" "\\" "\\\\" "Node2"[inputType=MFString]
[e-q-c-r][6][e-q-c-r input][local-name()=string]Node2" "\\" "\\\\" "Node2"[inputType=MFString]
[e-q-c-r][3.5][e-q-c-r input][local-name()=string]\\" "\\\\" "Node2"[inputType=MFString]
[e-q-c-r][4.1][e-q-c-r input][local-name()=string]" "\\\\" "Node2"[inputType=MFString]
[e-q-c-r][3.5][e-q-c-r input][local-name()=string]\\\\" "Node2"[inputType=MFString]
[e-q-c-r][3.5][e-q-c-r input][local-name()=string]\\" "Node2"[inputType=MFString]
[e-q-c-r][4.1][e-q-c-r input][local-name()=string]" "Node2"[inputType=MFString]
[e-q-c-r][8.1][e-q-c-r input][local-name()=string]Node2"[inputType=MFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=string][inputType=MFString]
[e-q-c-r][4.2][e-q-c-r input][local-name()=string]"Node3 \\\\ \\ " "Node3\"\"\""[inputType=MFString]
[e-q-c-r][3.5][e-q-c-r input][local-name()=string]Node3 \\\\ \\ " "Node3\"\"\""[inputType=MFString]
[e-q-c-r][3.5][e-q-c-r input][local-name()=string]\\ \\ " "Node3\"\"\""[inputType=MFString]
[e-q-c-r][3.5][e-q-c-r input][local-name()=string] \\ " "Node3\"\"\""[inputType=MFString]
[e-q-c-r][4.1][e-q-c-r input][local-name()=string] " "Node3\"\"\""[inputType=MFString]
[e-q-c-r][3.4][e-q-c-r input][local-name()=string]Node3\"\"\""[inputType=MFString]
[e-q-c-r][3.4][e-q-c-r input][local-name()=string]\"\""[inputType=MFString]
[e-q-c-r][3.4][e-q-c-r input][local-name()=string]\""[inputType=MFString]
[e-q-c-r][4.0][e-q-c-r input][local-name()=string]"[inputType=MFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=name]frontUrls[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=type]MFString[inputType=SFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=accessType]initializeOnly[inputType=SFString]
[e-q-c-r][4.2][e-q-c-r input][local-name()=value]"rnl_front.png" "uffizi_front.png"[inputType=MFString]
[e-q-c-r][6][e-q-c-r input][local-name()=value]rnl_front.png" "uffizi_front.png"[inputType=MFString]
[e-q-c-r][8.1][e-q-c-r input][local-name()=value]uffizi_front.png"[inputType=MFString]
[e-q-c-r][1.0][e-q-c-r input][local-name()=value][inputType=MFString]
Script contains CDATA source-code text, copied as "#sourceText" using "strings" mode
[e-q-c-r][8.3][e-q-c-r input][local-name()=]ecmascript:
			    var me = '"1" "\"2" "\n3"';[inputType=unknown]
[e-q-c-r][8.3][e-q-c-r input][local-name()=]1" "\"2" "\n3"';[inputType=unknown]
[e-q-c-r][8.3][e-q-c-r input][local-name()=] "\"2" "\n3"';[inputType=unknown]
[e-q-c-r][3.4][e-q-c-r input][local-name()=]\"2" "\n3"';[inputType=unknown]
[e-q-c-r][8.3][e-q-c-r input][local-name()=]2" "\n3"';[inputType=unknown]
[e-q-c-r][8.3][e-q-c-r input][local-name()=] "\n3"';[inputType=unknown]
[e-q-c-r][8.3][e-q-c-r input][local-name()=]\n3"';[inputType=unknown]
[e-q-c-r][1.0][e-q-c-r input][local-name()=]';[inputType=unknown]
..error checking with jslint
..error checking with json-schema-validator
--- BEGIN C:\x3d-code\www.web3d.org\x3d\stylesheets\test\HelloWorld.json---
validation: SUCCESS
--- END C:\x3d-code\www.web3d.org\x3d\stylesheets\test\HelloWorld.json---
BUILD SUCCESSFUL (total time: 4 seconds)
===============================================================================

thanks for another excellent test case.  am rerunning all json conversions tonight for regression test.

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 --------------
A non-text attachment was scrubbed...
Name: text.x3d
Type: model/x3d+xml
Size: 2105 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170726/1cb0ee75/attachment.x3d>
-------------- next part --------------
{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.3",
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json",
    "head": {
        "meta": [
          {
            "@name":"creator",
            "@content":"John W Carlson"
          },
          {
            "@name":"created",
            "@content":"December 13 2015"
          },
          {
            "@name":"title",
            "@content":"text.x3d"
          },
          {
            "@name":"identifier",
            "@content":"https://coderextreme.net/X3DJSONLD/text.x3d"
          },
          {
            "@name":"description",
            "@content":"test \n text"
          },
          {
            "@name":"generator",
            "@content":"Vim, X3D-Edit, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"translated",
            "@content":"26 July 2017"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, http://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"reference",
            "@content":"X3D JSON encoding: http://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "Transform":
            {
              "-children":[
                { "Shape":
                  {
                    "-geometry":
                      { "Text":
                        {
                          "@string":["Node\"\"\""],
                          "-fontStyle":
                            { "FontStyle":
                              {
                              }
                            }
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                              }
                            }
                        }
                      }
                  }
                },
                { "Shape":
                  {
                    "-geometry":
                      { "Text":
                        {
                          "@string":["Node2","\\","\\\\","Node2"],
                          "-fontStyle":
                            { "FontStyle":
                              {
                              }
                            }
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                              }
                            }
                        }
                      }
                  }
                },
                { "Shape":
                  {
                    "-geometry":
                      { "Text":
                        {
                          "@string":["Node3 \\\\ \\","Node3\"\"\""],
                          "-fontStyle":
                            { "FontStyle":
                              {
                              }
                            }
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                              }
                            }
                        }
                      }
                  }
                },
                { "Script":
                  {
                    "field": [
                      {
                        "@name":"frontUrls",
                        "@type":"MFString",
                        "@accessType":"initializeOnly",
                        "@value":["rnl_front.png","uffizi_front.png"]
                      }
                    ],
                    "#sourceText":[
"ecmascript:",
"\t\t\t    var me = '\"1\" \"\"2\" \"\n3\"';"
]
                  }
                }
              ]
            }
          }
        ]
    }
  }
}


More information about the x3d-public mailing list