[x3d-public] JSON encoding long line split in HelloWorldProgramOutput.java

John Carlson yottzumm at gmail.com
Mon Jul 3 08:30:32 PDT 2023


I'm working on temporarily patching HelloWorldProgramOutput.json to make it
so I can create Java from it.  I  know how to patch the java (Don, see
below enclosed--previous message).  I am now trying to repair the JSON I
use to create it. Note that the Java I produce does not have two sets
of @value diffs, probably because the JSON parser:

import javax.json.JsonObject;

dropped one with the same property name, as previously discussed.  I
suggest passing your JSON through jsonlint and diff, as this command does:
$ jsonlint C:/x3d-code/
www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.json |
diff - ../../../data/HelloWorldProgramOutput.json
[snipped output,  if you want evidence, mail me privately]

diff ../../../data/HelloWorldProgramOutput.json /c/x3d-code/
www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.json
103c103
<             "@content":"1 July 2023"
---
>             "@content":"3 July 2023"
226c226
<               "@value":["Top-level root Metadata node beneath Scene needs
to be one of '-children' in ..."]
---
>               "@value":["Top-level root Metadata node beneath Scene needs
to be one of '-children' in JSON encoding"]
1482c1482
<               "@value":["Top-level root Metadata node beneath Scene needs
to be one of '-children' in ..."]
---
>               "@value":["Top-level root Metadata node beneath Scene needs
to be one of '-children' in JSON encoding"]
2691c2691
< }
---
> }
\ No newline at end of file



On Mon, Jul 3, 2023 at 9:29 AM John Carlson <yottzumm at gmail.com> wrote:

> There's no HelloHelloWorldProgramOutput.java in the java/examples folder?
>
> I see the problem with the MetataString setValue method call:
>
> ---Original
> 203,204c203
> <     .addMetadata(new
> MetadataString("scene.addChildMetadata").setName("test").setValue(new
> String[] {"Top-level root Metadata node beneath Scene needs to be one of
> '-children' in JSON
> < encoding"}))
> ---Fixed
> >     .addMetadata(new
> MetadataString("scene.addChildMetadata").setName("test").setValue(new
> String[] {"Top-level root Metadata node beneath Scene needs to be one of
> '-children' in JSON encoding"}))
>
> Unquoted newlines are not allowed in Java. Search for the JSON at the end
> of the line, then join the two lines.  Corrected source code is attached.
>
> I'm not sure why Saxon??? is chopping the line in two.  I will research
> other versions of Saxon.  Maybe there was a change to X3dToJava.xslt>
>
> Thanks!
>
> John
>
> c:/x3d-code/www.web3d.org/x3d/stylesheets/java/examples
> $ ls -ltr *class *java
> -rw-r--r-- 1 john 197121 285815 Jul  2 01:49 CleatClamp.class
> -rw-r--r-- 1 john 197121 195539 Jul  2 01:49 CleatClamp.java
> -rw-r--r-- 1 john 197121 114112 Jul  2 01:49 HelloWorldProgram.java
> -rw-r--r-- 1 john 197121  36474 Jul  2 01:49 HelloWorldProgramOutput.class
> -rw-r--r-- 1 john 197121  11911 Jul  2 01:49 flowers4.class
> -rw-r--r-- 1 john 197121  69291 Jul  3 05:17 HelloWorldProgram.class
>
> c:/x3d-code/www.web3d.org/x3d/stylesheets/java/examples
> $ svn up .
> Updating '.':
> At revision 35199.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230703/b99299f4/attachment-0001.html>


More information about the x3d-public mailing list