<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
i'm sorry for the double post. Am always requesting too much from
computers..<br>
<br>
Now i have converted your version of JSON encoded X3D to incorporate
my suggestions.<br>
It's an HTML file that shows the changed JSON text.<br>
<br>
It also passes that to JSON.parse() in order to verify that it is
valid JSON.<br>
--> If it shows a line of JSON code between the two <hr>
lines, that worked.<br>
<br>
And after that it has little JavaScript code to demonstrate
accessing the generated object tree:<br>
It first traverses the tree to get to that one SFColor value that is
highlighted in red.<br>
For this it uses the JavaScript expression <tt>X3D.Scene[1].children[1].children[0].appearance.material.diffuseColor</tt>
.<br>
<br>
Then it extracts the meta info from the header and generates a table
out of this.<br>
To do so, it uses the following JavaScript:<br>
<br>
<tt>document.write('<table border=1>');<br>
for(var Idx in X3D.head)</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> var Item= X3D.head[Idx];</tt><tt><br>
</tt><tt> if(Item._type == 'meta')</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> document.write('<tr><td>'+
toHtml(Item.name) +'</td><td>'+ toHtml(Item.content)
+'</td></tr>');</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>}</tt><tt><br>
</tt><tt>document.write('</table>');</tt><tt><br>
</tt><br>
Now i try to rewrite this piece of code to match the version of JSON
without my suggestion:<br>
<br>
<tt><tt>document.write('<table border=1>');<br>
</tt>for(var Idx in X3D.head)<br>
{<br>
<font color="#cc0000">for(var Type in X3D.head[Idx])<br>
{</font><br>
if(Type == 'meta')<br>
{<br>
var Item= X3D.head[Idx]<font color="#cc0000">[Type]</font>;<br>
</tt><tt><tt> document.write('<tr><td>'+
toHtml(Item.name) +'</td><td>'+ toHtml(Item.content)
+'</td></tr>');</tt><br>
}<br>
<font color="#cc0000">}</font><br>
}<br>
</tt><tt>document.write('</table>');</tt><tt><br>
</tt><br>
Additional code marked in red. <br>
There is a whole new nested loop for this to scan.<br>
<tt><font color="#000099">if(<b>Item._type</b> == 'meta')</font></tt>
becomes <tt><font color="#000099">for(var Type in X3D.head[Idx]) {
if(Type == 'meta') ... }</font></tt><br>
<br>
The HTML is attached, but also online at <a
href="http://hersto.net/MailSupport/15-03-11-X3D-JSON/demo.html">http://hersto.net/MailSupport/15-03-11-X3D-JSON/demo.html</a>,<br>
works in Firefox and is not meant to conform to any best practice in
HTML, it just works.<br>
<br>
best regards,<br>
<br>
<i>Herbert Stocker<br>
<br>
<br>
</i><br>
On 10.03.2015 06:12, Herbert Stocker wrote:<br>
<span style="white-space: pre;">> Please don't read the previous
mail, it got headings messed up,<br>
> argh. This is the right, complete version:<br>
> <br>
> <br>
> <br>
> Hi Don and all,<br>
> <br>
> before jumping in on this, i've read all the discussions
preceding<br>
> this. Took me about 3 hours. One can do this only on spare
time. But<br>
> i was happy to see how people bring good arguments, factual
and <br>
> respectful (of course). And i would have argued into the same<br>
> directions, too.<br>
> <br>
> Though you say yourself that your current iteration of the
encoding<br>
> needs investigation,<br>
>> Still haven't compared it to interesting design
alternatives<br>
>> previously posted by Cecile, Yvonne, Kristian, John and
others.<br>
>> Continued exploration should help a "best of breed"
emerge, the<br>
>> problem space continues to shrink.<br>
> i would like to mention a few things that come to mind. Maybe
just to<br>
</span><br>
<snip><br>
<br>
<br>
</body>
</html>