[x3d-public] X3D JSON - comments preceding and following the X3D Element/Object

John Carlson yottzumm at gmail.com
Mon Jan 11 07:28:50 PST 2016


For example, the following X3D XML:

<?xml version="1.0" encoding="UTF-8"?>
<!--Comment before-->
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile="Interchange" version="3.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.3.xsd">
    <!--Comment before head-->
    <head>
        <meta name='title' content='FileName.x3d'/>
        <meta name='identifier' content='http://someAddress/somePath/FileName.x3d'/>
        <meta name='creator' content='Author Name'/>
        <meta name='description' content='topic sentence plus good summary'/>
        <meta name='generator' content='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
    </head>
    <!--comment between head and scene-->
    <Scene>
        <Group>
            <Shape> <Sphere/>
            <Appearance><Material diffuseColor="1 1 1"/></Appearance>
            </Shape>
                   
        </Group>
    </Scene>
    <!--comment after scene-->
</X3D>
<!--Comment after—>


——————————————————————
Becomes the X3D JSON below.  I think I have the most recent version of X3D-Edit.   If the stylesheet has been updated, let me know.
——————————————————————
"-children":[
  { "#comment":"Comment before"
  },
  { "#comment":"Comment after"
  }
],{ "X3D": {
    "@profile":"Interchange",
    "@version":3.3,
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd",
    "-children":[
      { "#comment":"Comment before head"
      },
      { "#comment":"comment between head and scene"
      },
      { "#comment":"comment after scene"
      }
    ],
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"FileName.x3d"
          },
          {
            "@name":"identifier",
            "@content":"http://someAddress/somePath/FileName.x3d"
          },
          {
            "@name":"creator",
            "@content":"Author Name"
          },
          {
            "@name":"description",
            "@content":"topic sentence plus good summary"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit, https://savage.nps.edu/X3D-Edit"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "Group":
            {
              "-children":[
                { "Shape":
                  {
                    "-geometry":[
                      { "Sphere":
                        {
                        }
                      }
                    ],
                    "-appearance":[
                      { "Appearance":
                        {
                          "-material":[
                            { "Material":
                              {
                                "@diffuseColor":[1,1,1]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
    }
  }
}


More information about the x3d-public mailing list