<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoPlainText>Don,<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Agreed with John's later comment that @class is not included in JSON. In fact, let's take that one step further and note that it is not included in the abstract standard. Words containing the letters "class" only appear four times in clause 4 of 19775-1 V3.3, and not at all in clause 7. None of the instances is concerned with the "class" attribute that is included in 19776-1. And looking at 19776-1, clause 4.3.6 class attribute syntax, the text states:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='color:#0070C0'>“The class attribute is reserved for use with XML Cascading Style Sheets (see [CSS]).”<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>So the class attribute is only for the XML encoding (and anything derived from it). Therefore it should not appear in JSON. And it doesn't.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Now what about IMPORT and EXPORT.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Let's look at the draft text in the working draft for ISO/IEC CD 19776-5, clause 4.3.2.15 "IMPORT" property syntax. The text reads:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoNormal><span style='color:#0070C0'>“The "IMPORT" property is an optional property of the "Scene" object. It is an array type, where each item is an object having the properties listed in Table 4.13. The first column lists the name of the property. The second column indicates whether the property is optional or required. The third column lists the reference to the detailed encoding of the property.”<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Table 4.13 lists three properties "@AS" which is optional, and "@importedDEF" and "@inlineDEF", both of which are required. No other properties are permitted. <o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>The "EXPORT" property is defined in an analogous manner. Here is an example from the draft standard:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span style='color:#0070C0'>"EXPORT": [<o:p></o:p></span></p><p class=MsoPlainText><span style='color:#0070C0'>   {<o:p></o:p></span></p><p class=MsoPlainText><span style='color:#0070C0'>      "@AS": "myNodeAlias",<o:p></o:p></span></p><p class=MsoPlainText><span style='color:#0070C0'>      "@localDEF": "myNode",<o:p></o:p></span></p><p class=MsoPlainText><span style='color:#0070C0'>   }<o:p></o:p></span></p><p class=MsoPlainText><span style='color:#0070C0'>]<o:p></o:p></span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Why is it done like that? Because JSON recommends, and we have followed this recommendation, that the property keys in any given object should not be duplicated. So, any single object, like "Scene", cannot have multiple IMPORT or EXPORT statements. They have to be collected together into an array. Each IMPORT statement has three properties, so needs to be an object.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Hope this helps,<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>All the best,<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Roy<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText><span lang=EN-US style='mso-fareast-language:EN-GB'>-----Original Message-----<br>From: Don Brutzman [mailto:brutzman@nps.edu] <br>Sent: 09 July 2017 23:55<br>To: Roy Walmsley <roy.walmsley@ntlworld.com>; John Carlson <yottzumm@gmail.com><br>Cc: X3D Graphics public mailing list <x3d-public@web3d.org><br>Subject: X3D JSON schema validation problems: @class and IMPORT/EXPORT attributes</span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Finally getting "back up on the horse" to test JSON conversions using X3dToJson.xslt (hooray!)<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Attached please find current version of X3DJSAIL output .x3d test scene, plus corresponding .json version.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Roy, it looks like there may be several omissions in the X3D JSON Schema:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>a. @class attribute (previously untested) not recognized<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>b. IMPORT/EXPORT statements (previously untested) are apparently expecting an array when simple attributes are provided<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>{ "IMPORT":<o:p></o:p></p><p class=MsoPlainText>   {<o:p></o:p></p><p class=MsoPlainText>                "@AS":"WorldInfoDEF2",<o:p></o:p></p><p class=MsoPlainText>                "@importedDEF":"WorldInfoDEF",<o:p></o:p></p><p class=MsoPlainText>                "@inlineDEF":"inlineSceneDef"<o:p></o:p></p><p class=MsoPlainText>   }<o:p></o:p></p><p class=MsoPlainText>},<o:p></o:p></p><p class=MsoPlainText>{ "EXPORT":<o:p></o:p></p><p class=MsoPlainText>   {<o:p></o:p></p><p class=MsoPlainText>                "@AS":"WorldInfoDEF3",<o:p></o:p></p><p class=MsoPlainText>                "@localDEF":"WorldInfoDEF"<o:p></o:p></p><p class=MsoPlainText>   }<o:p></o:p></p><p class=MsoPlainText>},<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Console output follows.  Please advise, TIA.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>=====================================<o:p></o:p></p><p class=MsoPlainText>translation input: test/HelloWorldProgramOutput.x3d ..expected output: test/HelloWorldProgramOutput.json Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode ..error checking with jslint jslint:test/HelloWorldProgramOutput.json:447:1:JavaScript URL.<o:p></o:p></p><p class=MsoPlainText>jslint:test/HelloWorldProgramOutput.json:812:1:JavaScript URL.<o:p></o:p></p><p class=MsoPlainText>Java Result: 1<o:p></o:p></p><p class=MsoPlainText>..error checking with json-schema-validator<o:p></o:p></p><p class=MsoPlainText>--- BEGIN C:\x3d-code\www.web3d.org\x3d\stylesheets\test\HelloWorldProgramOutput.json---<o:p></o:p></p><p class=MsoPlainText>validation: FAILURE<o:p></o:p></p><p class=MsoPlainText>[ {<o:p></o:p></p><p class=MsoPlainText>   "level" : "error",<o:p></o:p></p><p class=MsoPlainText>   "schema" : {<o:p></o:p></p><p class=MsoPlainText>     "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",<o:p></o:p></p><p class=MsoPlainText>     "pointer" : "/definitions/Box"<o:p></o:p></p><p class=MsoPlainText>   },<o:p></o:p></p><p class=MsoPlainText>   "instance" : {<o:p></o:p></p><p class=MsoPlainText>     "pointer" : "/X3D/Scene/-children/5/Transform/-children/0/Anchor/-children/0/Shape/-geometry/Box"<o:p></o:p></p><p class=MsoPlainText>   },<o:p></o:p></p><p class=MsoPlainText>   "domain" : "validation",<o:p></o:p></p><p class=MsoPlainText>   "keyword" : "additionalProperties",<o:p></o:p></p><p class=MsoPlainText>   "message" : "object instance has properties which are not allowed by the schema: [\"@class\"]",<o:p></o:p></p><p class=MsoPlainText>   "unwanted" : [ "@class" ]<o:p></o:p></p><p class=MsoPlainText>}, {<o:p></o:p></p><p class=MsoPlainText>   "level" : "error",<o:p></o:p></p><p class=MsoPlainText>   "schema" : {<o:p></o:p></p><p class=MsoPlainText>     "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",<o:p></o:p></p><p class=MsoPlainText>     "pointer" : "/definitions/IMPORT"<o:p></o:p></p><p class=MsoPlainText>   },<o:p></o:p></p><p class=MsoPlainText>   "instance" : {<o:p></o:p></p><p class=MsoPlainText>     "pointer" : "/X3D/Scene/-children/24/IMPORT"<o:p></o:p></p><p class=MsoPlainText>   },<o:p></o:p></p><p class=MsoPlainText>   "domain" : "validation",<o:p></o:p></p><p class=MsoPlainText>   "keyword" : "type",<o:p></o:p></p><p class=MsoPlainText>   "message" : "instance type (object) does not match any allowed primitive type (allowed: [\"array\"])",<o:p></o:p></p><p class=MsoPlainText>   "found" : "object",<o:p></o:p></p><p class=MsoPlainText>   "expected" : [ "array" ]<o:p></o:p></p><p class=MsoPlainText>}, {<o:p></o:p></p><p class=MsoPlainText>   "level" : "error",<o:p></o:p></p><p class=MsoPlainText>   "schema" : {<o:p></o:p></p><p class=MsoPlainText>     "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",<o:p></o:p></p><p class=MsoPlainText>     "pointer" : "/definitions/EXPORT"<o:p></o:p></p><p class=MsoPlainText>   },<o:p></o:p></p><p class=MsoPlainText>   "instance" : {<o:p></o:p></p><p class=MsoPlainText>     "pointer" : "/X3D/Scene/-children/25/EXPORT"<o:p></o:p></p><p class=MsoPlainText>   },<o:p></o:p></p><p class=MsoPlainText>   "domain" : "validation",<o:p></o:p></p><p class=MsoPlainText>   "keyword" : "type",<o:p></o:p></p><p class=MsoPlainText>   "message" : "instance type (object) does not match any allowed primitive type (allowed: [\"array\"])",<o:p></o:p></p><p class=MsoPlainText>   "found" : "object",<o:p></o:p></p><p class=MsoPlainText>   "expected" : [ "array" ]<o:p></o:p></p><p class=MsoPlainText>} ]<o:p></o:p></p><p class=MsoPlainText>--- END C:\x3d-code\www.web3d.org\x3d\stylesheets\test\HelloWorldProgramOutput.json---<o:p></o:p></p><p class=MsoPlainText>Java Result: 100<o:p></o:p></p><p class=MsoPlainText>=====================================<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>p.s. John it looks like MetadataString "@value conversion is incorrectly encoding " as &quot; instead of \" (though #comment and other values look OK), will work on it.<o:p></o:p></p><p class=MsoPlainText>all the best, Don<o:p></o:p></p><p class=MsoPlainText>-- <o:p></o:p></p><p class=MsoPlainText>Don Brutzman  Naval Postgraduate School, Code USW/Br       <a href="mailto:brutzman@nps.edu"><span style='color:windowtext;text-decoration:none'>brutzman@nps.edu</span></a><o:p></o:p></p><p class=MsoPlainText>Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149<o:p></o:p></p><p class=MsoPlainText>X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman"><span style='color:windowtext;text-decoration:none'>http://faculty.nps.edu/brutzman</span></a><o:p></o:p></p></div></body></html>