[x3d-public] X3dToJson.xslt. Setting normalizeCommentWhitespace parameter to false causes illegal JSON

John Carlson yottzumm at gmail.com
Tue Mar 6 20:02:18 PST 2018


Don,

If I set normalizeCommentWhitespace to false in X3dToJson.xslt, thus:

  <xsl:param name="normalizeCommentWhitespace"><xsl:text>false</xsl:text></xsl:param>

I get illegal JSON.   See attached JSON and X3D.

$ jsonlint ../data/flowerproto.json
Error: Parse error on line 208:
...         "#comment":"
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
    at Object.parseError (C:\Users\coderextreme\AppData\Roaming\nvm\v8.9.3\node_modules\jsonlint\lib\jsonlint.js:55:11)
    at Object.parse (C:\Users\coderextreme\AppData\Roaming\nvm\v8.9.3\node_modules\jsonlint\lib\jsonlint.js:132:22)
    at parse (C:\Users\coderextreme\AppData\Roaming\nvm\v8.9.3\node_modules\jsonlint\lib\cli.js:82:14)
    at main (C:\Users\coderextreme\AppData\Roaming\nvm\v8.9.3\node_modules\jsonlint\lib\cli.js:135:14)
    at Object.<anonymous> (C:\Users\coderextreme\AppData\Roaming\nvm\v8.9.3\node_modules\jsonlint\lib\cli.js:179:1)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

There are non-escaped newlines, thus:


                                          "-children":[
                                            {
                                              "#comment":"
                                <field name='cube' type='SFNode' accessType=\"inputOutput\">
                                    <ComposedCubeMapTexture USE=\"texture\"/>
                                </field>
                                "
                                            }
                                          ],
    

John


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180306/a023a9d7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flowerproto.json
Type: application/json
Size: 20560 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180306/a023a9d7/attachment-0001.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flowerproto.x3d
Type: application/octet-stream
Size: 8222 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180306/a023a9d7/attachment-0001.obj>


More information about the x3d-public mailing list