<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Okay, I just built the x3d/stylesheets/build.xml ant target<br>
</p>
<p>test.HelloWorldProgram.java</p>
<p><br>
</p>
<p>Looking for an ant target that includes that with
create.X3DJSAIL.</p>
<p><br>
</p>
<p>Sorry about the repeated bug report emails. Is there an update
to X3dToJava.xslt or not? Waiting.</p>
<p><br>
</p>
<p>Here's the changes that my X3dToJava.xslt affected in the Java
file:</p>
<p><br>
</p>
<p><br>
</p>
<p>x3d/stylesheets/java/examples$ svn diff
HelloWorldProgramOutput.java <br>
Index: HelloWorldProgramOutput.java<br>
===================================================================<br>
--- HelloWorldProgramOutput.java (revision 31914)<br>
+++ HelloWorldProgramOutput.java (working copy)<br>
@@ -59,7 +59,7 @@<br>
</tr><br>
<tr><br>
<td style="text-align:right;
vertical-align: text-top;"> <i> modified </i>
</td><br>
- <td> 4 February 2021 </td><br>
+ <td> 16 May 2021 </td><br>
</tr><br>
<tr><br>
<td style="text-align:right;
vertical-align: text-top;"> <i> generator </i>
</td><br>
@@ -163,7 +163,7 @@<br>
.addMeta(new meta().setName(meta.NAME_REFERENCE
).setContent(<a class="moz-txt-link-rfc2396E" href="https://www.web3d.org/specifications/java/X3DJSAIL.html">"https://www.web3d.org/specifications/java/X3DJSAIL.html"</a>))<br>
.addMeta(new meta().setName(meta.NAME_GENERATOR
).setContent("HelloWorldProgramOutput.java"))<br>
.addMeta(new meta().setName(meta.NAME_CREATED
).setContent("6 September 2016"))<br>
- .addMeta(new meta().setName(meta.NAME_MODIFIED
).setContent("4 February 2021"))<br>
+ .addMeta(new meta().setName(meta.NAME_MODIFIED
).setContent("16 May 2021"))<br>
.addMeta(new meta().setName(meta.NAME_GENERATOR
).setContent("X3D Java Scene Access Interface Library
(X3DJSAIL)"))<br>
.addMeta(new meta().setName(meta.NAME_GENERATOR
).setContent(<a class="moz-txt-link-rfc2396E" href="https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java">"https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java"</a>))<br>
.addMeta(new meta().setName(meta.NAME_GENERATOR
).setContent("Netbeans <a class="moz-txt-link-freetext" href="http://www.netbeans.org">http://www.netbeans.org</a>"))<br>
@@ -213,8 +213,8 @@<br>
.addComments(" Comment example A, plain quotation
marks: He said, \"Immel did it!\" ")<br>
.addComments(" Comment example B, XML character
entities: He said, "Immel did it!" ")<br>
.setMetadata(new
MetadataSet().setName("EscapedQuotationMarksMetadataSet")<br>
- .setMetadata(new
MetadataString().setName("quotesTestC").setValue(new String[]
{"MFString example C, backslash-escaped quotes: He said, \"Immel
did it!\""}))<br>
- .setMetadata(new
MetadataString().setName("extraChildTest").setValue(new String[]
{"checks MetadataSet addValue() method"})))<br>
+ .addValue(new
MetadataString().setName("quotesTestC").setValue(new String[]
{"MFString example C, backslash-escaped quotes: He said, \"Immel
did it!\""}))<br>
+ .addValue(new
MetadataString().setName("extraChildTest").setValue(new String[]
{"checks MetadataSet addValue() method"})))<br>
.setFontStyle(new
FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE))))<br>
.addChild(new Collision()<br>
.addComments(" test containerField='proxy' ")Oh, I just
realized my changes may have affected the Java output.</p>
<br>
<p>Thanks,</p>
<p>John<br>
</p>
<div class="moz-cite-prefix">On 5/14/21 7:50 AM, John Carlson wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGC3UE=MiHg5cindNbb8r0PXENo+PpD80Rg9twt9chr+SFNG1g@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">Another option is to change the setMetadata method
to /and/ instead of /or/. Someone else needs to workout that
logic.</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, May 13, 2021 at 8:14
PM John Carlson <<a href="mailto:yottzumm@gmail.com"
moz-do-not-send="true">yottzumm@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">I
got it all worked out I think, but it may require further
testing. I <br>
simply promoted the addValue method above the setMetadata
method. I <br>
think that's all that's required.<br>
<br>
Here's the patch to X3dToJava.xslt. I have my own copy of
the <br>
stylesheets, so you'll have to update sourceforge, etc.<br>
<br>
diff --git a/src/main/lib/stylesheets/X3dToJava.xslt <br>
b/src/main/lib/stylesheets/X3dToJava.xslt<br>
index dd5625e97..e1082485d 100644<br>
--- a/src/main/lib/stylesheets/X3dToJava.xslt<br>
+++ b/src/main/lib/stylesheets/X3dToJava.xslt<br>
@@ -1246,6 +1246,11 @@ POSSIBILITY OF SUCH DAMAGE.<br>
<xsl:apply-templates <br>
select="."/><!-- handle this node --><br>
<xsl:text>)</xsl:text><br>
</xsl:when><br>
+ <xsl:when
test="(local-name(..) = <br>
'MetadataSet') and ($containerField = 'value')"><br>
+ <xsl:text>.addValue(</xsl:text><br>
+
<xsl:apply-templates <br>
select="."/><!-- handle this node --><br>
+ <xsl:text>)</xsl:text><br>
+ </xsl:when><br>
<xsl:when
test="(($containerField = <br>
'metadata') or starts-with(local-name(), 'Metadata'))"><br>
<xsl:text>.setMetadata(</xsl:text><br>
<xsl:apply-templates <br>
select="."/><!-- handle this node --><br>
@@ -1347,11 +1352,6 @@ POSSIBILITY OF SUCH DAMAGE.<br>
<xsl:apply-templates <br>
select="."/><!-- handle this node --><br>
<xsl:text>)</xsl:text><br>
</xsl:when><br>
- <xsl:when
test="(local-name(..) = <br>
'MetadataSet') and ($containerField = 'value')"><br>
- <xsl:text>.addValue(</xsl:text><br>
-
<xsl:apply-templates <br>
select="."/><!-- handle this node --><br>
- <xsl:text>)</xsl:text><br>
- </xsl:when><br>
<xsl:when
test="(local-name(..) = <br>
'RigidBody') and ($containerField = 'geometry')"><br>
<xsl:text>.addGeometry(</xsl:text><br>
<xsl:apply-templates <br>
select="."/><!-- handle this node --><br>
<br>
On 5/13/21 7:29 PM, John Carlson wrote:<br>
> Don, important needed changes to Java generated by
X3DJSAIL and <br>
> X3dToJava.xslt. containerField="value" in enclosed
XML should not <br>
> generate setMetadata(), instead, it should generate
addValue()<br>
><br>
><br>
> Okay, as it stands, this Java code does not compile:<br>
><br>
> .addChild(new Shape()<br>
> .setAppearance(new Appearance()<br>
> .setMaterial(new
Material().setUSE("GreenMaterial")))<br>
> .setGeometry(new Text().setString(new <br>
> org.web3d.x3d.jsail.fields.MFString(new
MFString7().getArray()))<br>
> .addComments("Comment example A, plain
quotation marks: <br>
> He said, \"Immel did it!\"")<br>
> .addComments("Comment example B, XML
character entities: <br>
> He said, "Immel did it!"")<br>
> .setMetadata(new <br>
>
MetadataSet().setName("EscapedQuotationMarksMetadataSet")<br>
> .setValue(new <br>
> MetadataString().setName("quotesTestC").setValue(new <br>
> org.web3d.x3d.jsail.fields.MFString(new
MFString8().getArray())))<br>
> .addValue(new <br>
> MetadataString().setName("extraChildTest").setValue(new
<br>
> org.web3d.x3d.jsail.fields.MFString(new
MFString9().getArray()))))<br>
> .setFontStyle(new
FontStyle().setJustify(new <br>
> org.web3d.x3d.jsail.fields.MFString(new
MFString10().getArray())))))<br>
><br>
><br>
>
../java/net/coderextreme/data/HelloWorldProgramOutputCanonical.java<br>
> HelloWorldProgramOutputCanonical.java:120: error: void
cannot be <br>
> dereferenced<br>
> .addValue(new <br>
> MetadataString().setName("extraChildTest").setValue(new
<br>
> org.web3d.x3d.jsail.fields.MFString(new
MFString9().getArray()))))<br>
> ^<br>
> 1 error<br>
><br>
><br>
> Which indicates that I was originally right, and I
should replace <br>
> setValue with addValue. So much for going with one's
gut instinct.<br>
><br>
> Don, can you suggest how I might do it with this
setValue() method?<br>
><br>
> public MetadataSet
setValue(org.web3d.x3d.sai.Core.X3DNode[] newValue);<br>
><br>
> I'm seeing the double new MFString and going what is
going on? So I <br>
> made some patches:<br>
><br>
><br>
> .addChild(new Shape()<br>
> .setAppearance(new Appearance()<br>
> .setMaterial(new
Material().setUSE("GreenMaterial")))<br>
> .setGeometry(new Text().setString(new
MFString7().getArray())<br>
> .addComments("Comment example A, plain
quotation marks: <br>
> He said, \"Immel did it!\"")<br>
> .addComments("Comment example B, XML
character entities: <br>
> He said, "Immel did it!"")<br>
> .setMetadata(new <br>
>
MetadataSet().setName("EscapedQuotationMarksMetadataSet")<br>
> .setValue(new <br>
> MetadataString().setName("quotesTestC").setValue(new <br>
> MFString8().getArray()))<br>
> .addValue(new <br>
> MetadataString().setName("extraChildTest").setValue(new
<br>
> MFString9().getArray())))<br>
> .setFontStyle(new
FontStyle().setJustify(new <br>
> MFString10().getArray()))))<br>
><br>
><br>
><br>
> But still seeing a similar error:<br>
><br>
>
../java/net/coderextreme/data/HelloWorldProgramOutputCanonical.java<br>
> HelloWorldProgramOutputCanonical.java:120: error: void
cannot be <br>
> dereferenced<br>
> .addValue(new <br>
> MetadataString().setName("extraChildTest").setValue(new
<br>
> MFString9().getArray())))<br>
> ^<br>
> 1 error<br>
><br>
> Don, I recommend you use addValue instead of
setMetadata for both Values.<br>
><br>
> John<br>
><br>
> On 5/13/21 7:04 PM, John Carlson wrote:<br>
>> Hold my horses. My JSON version indicates that the
JSON could be <br>
>> wrong as well. Here is JSON in question:<br>
>><br>
>><br>
>> "-metadata":<br>
>> { "MetadataSet":<br>
>> {<br>
>> "@name":"EscapedQuotationMarksMetadataSet",<br>
>> "-value":[<br>
>> {
"MetadataString":<br>
>> {<br>
>>
"@name":"quotesTestC",<br>
>>
"@value":["MFString example C, <br>
>> backslash-escaped quotes: He said, \"Immel did
it!\""]<br>
>> }<br>
>> },<br>
>> {
"MetadataString":<br>
>> {<br>
>>
"@name":"extraChildTest",<br>
>>
"@value":["checks <br>
>> MetadataSetObject addValue() method"]<br>
>> }<br>
>> }<br>
>> ]<br>
>> }<br>
>> },<br>
>><br>
>><br>
>> Pulling up XML:<br>
>><br>
>><br>
>> <MetadataSet
name='EscapedQuotationMarksMetadataSet'><br>
>> <MetadataString
containerField='value' name='quotesTestC' <br>
>> value='"MFString example C, backslash-escaped
quotes: He said, <br>
>> \"Immel did it!\""'/><br>
>> <MetadataString
containerField='value' <br>
>> name='extraChildTest' value='"checks
MetadataSetObject addValue() <br>
>> method"'/><br>
>> </MetadataSet><br>
>><br>
>> So the JSON translation is correct. Please patch
X3dToJava.xslt for <br>
>> this case.<br>
>><br>
>> I'm seeing that by setValue()/addValue() code was
correct to start <br>
>> with, so I'm backing out changes (i didn't check
them in).<br>
>><br>
>> On 5/13/21 5:45 PM, John Carlson wrote:<br>
>>> I will attempt to copy your Java source,
hopefully in the near term. <br>
>>> I'm in search of a libodejava for amd64 right
now.<br>
>>><br>
>>> John<br>
>>><br>
>>> On 5/13/21 4:40 PM, Don Brutzman wrote:<br>
>>>> thanks for your note. response:<br>
>>>><br>
>>>> On 5/9/2021 3:17 PM, John Carlson wrote:<br>
>>>>> Don, hope to cover this in our JSON/JS
meeting on Monday.<br>
>>>>><br>
>>>>> X3DXML attached.<br>
>>>>><br>
>>>>> ==<br>
>>>>><br>
>>>>> Should we add "addMetadata" to
MetadataSet.java?<br>
>>>>><br>
>>>>> Used addValue instead of setValue
(needs to be fully tested, was <br>
>>>>> getting void value returned from
setValue), changes to Java and <br>
>>>>> Node serializers.<br>
>>>><br>
>>>> * X3DJSAIL MetadataSet javadoc<br>
>>>> <a
href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/MetadataSet.html"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/MetadataSet.html</a>
<br>
>>>><br>
>>>><br>
>>>> The accessor (i.e. get and set) methods
follow consistent patterns <br>
>>>> that match the field type.<br>
>>>><br>
>>>> MetadataSet (like every other node) can
contain a single Metadata* <br>
>>>> node in the /metadata/ field to help
describe the purpose of the <br>
>>>> parent.<br>
>>>><br>
>>>> * setMetadata() method is singular, it only
takes an SFNode, since <br>
>>>> the /metadata/ field is an SFNode field<br>
>>>> <a
href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/MetadataSet.html#setMetadata(org.web3d.x3d.sai.Core.X3DMetadataObject)"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/MetadataSet.html#setMetadata(org.web3d.x3d.sai.Core.X3DMetadataObject)</a>
<br>
>>>><br>
>>>><br>
>>>> MetadataSet
setMetadata(X3DMetadataObject newValue)<br>
>>>> Accessor method to assign <br>
>>>> org.web3d.x3d.sai.Core.X3DMetadataObject
instance<br>
>>>> (using a properly typed node) to
inputOutput SFNode field <br>
>>>> metadata.<br>
>>>><br>
>>>> MetadataSet can also contain a /value/
field which is an MFNode <br>
>>>> array of Metadata* nodes that contain the
metadata information of <br>
>>>> interest.<br>
>>>><br>
>>>> * addValue() has three methods which can
append a single node or <br>
>>>> array of nodes to the field.<br>
>>>><br>
>>>> * setValue() has two methods which can set
a single node or an <br>
>>>> array, replacing any prior contents in the
/value/ field.<br>
>>>><br>
>>>> so I think that all of the cases you
describe are covered <br>
>>>> satisfactorily now.<br>
>>>><br>
>>>> Certainly "metadata about metadata" and
"metadata collections" are <br>
>>>> easily confused, so it is important to have
consistent design <br>
>>>> patterns.<br>
>>>><br>
>>>> If you see a potential improvement to
javadoc descriptions (which <br>
>>>> flow from X3DUOM and X3D Tooltips) please
advise. Similarly am <br>
>>>> trying to embody these patterns in
X3dToJava.xslt stylesheet <br>
>>>> conversions exactly, so that can help
provide examples for any <br>
>>>> model when coding natively with X3DJSAIL.<br>
>>>><br>
>>>> Hope this explains the existing situation
to your satisfaction.<br>
>>>><br>
>>>>> Discussion of whether addValue should
be allowed after setValue or <br>
>>>>> not. Here's current (not checked in)
serializer Java translation:<br>
>>>>><br>
>>>>> .addChild(new Shape()<br>
>>>>> .setAppearance(new
Appearance()<br>
>>>>> .setMaterial(new
Material().setUSE("GreenMaterial")))<br>
>>>>> .setGeometry(new
Text().setString(new <br>
>>>>> org.web3d.x3d.jsail.fields.MFString(new
MFString7().getArray()))<br>
>>>>> .addComments(new
CommentsBlock("Comment example A, <br>
>>>>> plain quotation marks: He said, \"Immel
did it!\""))<br>
>>>>> .addComments(new
CommentsBlock("Comment example B, <br>
>>>>> XML character entities: He said,
"Immel did it!""))<br>
>>>>> .setMetadata(new <br>
>>>>>
MetadataSet().setName("EscapedQuotationMarksMetadataSet")<br>
>>>>> .addValue(new <br>
>>>>>
MetadataString().setName("quotesTestC").setValue(new <br>
>>>>> org.web3d.x3d.jsail.fields.MFString(new
MFString8().getArray())))<br>
>>>>> .addValue(new <br>
>>>>>
MetadataString().setName("extraChildTest").setValue(new <br>
>>>>> org.web3d.x3d.jsail.fields.MFString(new
MFString9().getArray()))))<br>
>>>>> .setFontStyle(new
FontStyle().setJustify(new <br>
>>>>> org.web3d.x3d.jsail.fields.MFString(new
MFString10().getArray())))))<br>
>>>>><br>
>>>>> Here's the stylesheet translation:<br>
>>>>><br>
>>>>> .addChild(new Shape()<br>
>>>>> .setAppearance(new
Appearance()<br>
>>>>> .setMaterial(new
Material().setUSE("GreenMaterial")))<br>
>>>>> .setGeometry(new
Text().setString(new String[] {"X3D <br>
>>>>> Java","SAI Library","X3DJSAIL"})<br>
>>>>> .addComments(" Comment
example A, plain quotation <br>
>>>>> marks: He said, \"Immel did it!\" ")<br>
>>>>> .addComments(" Comment
example B, XML character <br>
>>>>> entities: He said, "Immel did
it!" ")<br>
>>>>> .setMetadata(new <br>
>>>>>
MetadataSet().setName("EscapedQuotationMarksMetadataSet")<br>
>>>>> .setMetadata(new <br>
>>>>>
MetadataString().setName("quotesTestC").setValue(new
String[] <br>
>>>>> {"MFString example C, backslash-escaped
quotes: He said, \"Immel <br>
>>>>> did it!\""}))<br>
>>>>> .setMetadata(new <br>
>>>>>
MetadataString().setName("extraChildTest").setValue(new
String[] <br>
>>>>> {"checks MetadataSetObject addValue()
method"})))<br>
>>>>> .setFontStyle(new <br>
>>>>>
FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE))))<br>
>>>>><br>
>>>>><br>
>>>>> This looks like it would overwrite the
previous MetadataString, <br>
>>>>> but it looks like it just sets the
Parent? Would addMetadata be <br>
>>>>> more descriptive?<br>
>>>>><br>
>>>>><br>
>>>>> Here are methods on MetadataSet:<br>
>>>>><br>
>>>>> public final MetadataSet
setCssClass(String newValue)<br>
>>>>> public final MetadataSet
setCssStyle(String newValue)<br>
>>>>> public final MetadataSet
setDEF(String newValue)<br>
>>>>> public final MetadataSet
setName(String newValue)<br>
>>>>> public final MetadataSet
setUSE(String newValue)<br>
>>>>> public MetadataSet addComments
(CommentsBlock <br>
>>>>> newCommentsBlock)<br>
>>>>> public MetadataSet addComments
(String newComment)<br>
>>>>> public MetadataSet addComments
(String[] newComments)<br>
>>>>> public MetadataSet <br>
>>>>> addValue(org.web3d.x3d.sai.Core.X3DNode
newValue)<br>
>>>>> public MetadataSet
addValue(ProtoInstance newValue)<br>
>>>>> public MetadataSet
setCssClass(SFString newValue)<br>
>>>>> public MetadataSet
setCssStyle(SFString newValue)<br>
>>>>> public MetadataSet
setDEF(SFString newValue)<br>
>>>>> */ public MetadataSet
setIS(IS newValue)<br>
>>>>> public MetadataSet
setMetadata( <br>
>>>>>
org.web3d.x3d.sai.Core.X3DMetadataObject newValue)<br>
>>>>> public MetadataSet
setMetadata(ProtoInstance newValue)<br>
>>>>> public MetadataSet
setName(SFString newValue)<br>
>>>>> public MetadataSet
setReference(SFString newValue)<br>
>>>>> public MetadataSet
setReference(String newValue)<br>
>>>>> public MetadataSet
setUSE(MetadataSet DEFnode)<br>
>>>>> public MetadataSet
setUSE(SFString newValue)<br>
>>>>> public MetadataSet
setValue(ArrayList< <br>
>>>>>
org.web3d.x3d.sai.Core.X3DMetadataObject> newValue)<br>
>>>>> public MetadataSet <br>
>>>>>
setValue(org.web3d.x3d.sai.Core.X3DNode[] newValue)<br>
>>>>> public void
addValue(org.web3d.x3d.sai.Core.X3DNode[] <br>
>>>>> newValue)<br>
>>>>> public void
setValue(org.web3d.x3d.sai.Core.X3DNode <br>
>>>>> newValue)<br>
>>>>><br>
>>>>><br>
>>>>> what do people think? I'm think we
should do addMetadata or <br>
>>>>> setMetadata.<br>
>>>>><br>
>>>>> ==<br>
>>>>><br>
>>>>> No testing on python/x3dpsail/pyjnius
or x3d.py done.<br>
>>>>><br>
>>>>> ==<br>
>>>>><br>
>>>>> Output from Java (.new.json) appears
slightly different than <br>
>>>>> stylesheet (diff below). This may be a
concern. Here are the 2 <br>
>>>>> versions of Java, one of which
(coderextreme) outputs the .new.json.<br>
>>>>><br>
>>>>><br>
>>>>> $ egrep -w 'Immel|it'
net/*/data/Hello*cal.java|grep '\\\\\\'<br>
>>>>>
net/coderextreme/data/HelloWorldProgramOutputCanonical.java:
<br>
>>>>> .addComments("alternative Java source:
.setString(new String [] <br>
>>>>> {\"One, Two, Comment\", \"\", \"He
said, \\\"\"Immel did <br>
>>>>> it!\\\"\"\"})")<br>
>>>>>
net/x3djsonld/data/HelloWorldProgramOutputCanonical.java: <br>
>>>>> .addComments(" alternative Java source:
.setString(new String [] <br>
>>>>> {\"One, Two, Comment\", \"\", \"He
said, \\\"Immel did it!\\\"\"}) ")<br>
>>>>><br>
>>>>> I will attempt to output JSON from the
later Java to insure it <br>
>>>>> does the right thing.<br>
>>>>><br>
>>>>><br>
>>>>> The JSON output from Don's Java
(x3djsonld above) code (from a <br>
>>>>> recent version of X3dToJava.xslt)
produced the following when run <br>
>>>>> through jsonlint:<br>
>>>>><br>
>>>>> Error: Parse error on line 60:<br>
>>>>> ...iption","@content":"Example
HelloWorldP<br>
>>>>> ----------------------^<br>
>>>>> Expecting 'STRING', 'NUMBER', 'NULL',
'TRUE', 'FALSE', '{', '[', <br>
>>>>> got 'undefined'<br>
>>>>><br>
>>>>> Actual line is:<br>
>>>>><br>
>>>>> 60 "@content":"Example
HelloWorldProgram creates an X3D model <br>
>>>>> using the X3D Java Scene<br>
>>>>><br>
>>>>> My guess is there's a newline in there
(after Scene), probably <br>
>>>>> created by Saxon (default XSLT
processor) in X3DJSAIL. Please <br>
>>>>> migrate to a preferred stylesheet
processor. The stylesheet how I <br>
>>>>> run it in X3DJSONLD appears to be OK.
Don's Java app looks ok, <br>
>>>>> except for use of Saxon.<br>
>>>>><br>
>>>>> Here's what I do in X3DJSONLD testing:<br>
>>>>><br>
>>>>> java -cp
~/pythonSAI/X3DJSAIL.4.0.full.jar:../java <br>
>>>>> net.coderextreme.RunSaxon ---
---overwrite <br>
>>>>> --../lib/stylesheets/X3dToJson.xslt
-json <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.x3d<br>
>>>>><br>
>>>>> My RunSaxon.java is here:<br>
>>>>><br>
>>>>> <a
href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcoderextreme%2FX3DJSONLD%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Fnet%2Fcoderextreme%2FRunSaxon.java&data=04%7C01%7Cbrutzman%40nps.edu%7C52c3f9901bc84f93e37408d913384dbc%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637561955256442500%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VWidf0rTpCqH8NUb%2BJ8eVptJyVaS4GL2kJMAoX2mbzA%3D&reserved=0"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcoderextreme%2FX3DJSONLD%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Fnet%2Fcoderextreme%2FRunSaxon.java&data=04%7C01%7Cbrutzman%40nps.edu%7C52c3f9901bc84f93e37408d913384dbc%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637561955256442500%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VWidf0rTpCqH8NUb%2BJ8eVptJyVaS4GL2kJMAoX2mbzA%3D&reserved=0</a>
<br>
>>>>><br>
>>>>><br>
>>>>> Please review my code and try to
duplicate in ant, or we can <br>
>>>>> review jar versions. For people trying
to generate X3D JSON from <br>
>>>>> Java, this could be painful right now.<br>
>>>>><br>
>>>>> For example, I put this in my Java
apps:<br>
>>>>><br>
>>>>>
ConfigurationProperties.setXsltEngine(ConfigurationProperties.XSLT_ENGINE_NATIVE_JAVA);
<br>
>>>>><br>
>>>>><br>
>>>>> I can test this in Don's code.
Works! Attached Don's Java code <br>
>>>>> as modified by me. Suggested line
above as addition to <br>
>>>>> X3dToJava.xslt stylesheet.<br>
>>>>><br>
>>>>><br>
>>>>> There are a lot of differences in JSON
generated by Don's code and <br>
>>>>> JSON generated by my code. I suggest
a conference. What <br>
>>>>> stylesheet processor works best?<br>
>>>>><br>
>>>>> =============<br>
>>>>><br>
>>>>> Extra quotes in comments:<br>
>>>>><br>
>>>>><br>
>>>>> Running through my Java code:<br>
>>>>><br>
>>>>> $ diff
../data/HelloWorldProgramOutputCanonical.*json<br>
>>>>> 390c390<br>
>>>>> <
"#comment":"alternative Java <br>
>>>>> source: .setString(new String []
{\"One, Two, Comment\", \"\", <br>
>>>>> \"He said, \\\"\"Immel did
it!\\\"\"\"})"<br>
>>>>> ---<br>
>>>>> > "#comment":"alternative Java
source: .setString(new String [] <br>
>>>>> {\"One, Two, Comment\", \"\", \"He
said, \\\"\"\"Immel did <br>
>>>>> it!\\\"\"\"\"})"<br>
>>>>><br>
>>>>><br>
>>>>> My Java code, generated by converting
JSON to XML then Java.<br>
>>>>><br>
>>>>>
.addComments("alternative Java source: <br>
>>>>> .setString(new String [] {\"One, Two,
Comment\", \"\", \"He said, <br>
>>>>> \\\"\"Immel did it!\\\"\"\"})")<br>
>>>>><br>
>>>>> Don's Java code:<br>
>>>>><br>
>>>>> .addComments(" alternative
Java source: .setString(new <br>
>>>>> String [] {\"One, Two, Comment\", \"\",
\"He said, \\\"Immel did <br>
>>>>> it!\\\"\"}) ")<br>
>>>>><br>
>>>>> XML:<br>
>>>>><br>
>>>>> <!-- alternative Java source:
.setString(new String [] {"One, Two, <br>
>>>>> Comment", "", "He said, \"Immel did
it!\""}) --><br>
>>>>><br>
>>>>> JSON -> XML DOM dump prior to
serialization:<br>
>>>>><br>
>>>>> <!--alternative Java source:
.setString(new String [] {"One, Two, <br>
>>>>> Comment", "", "He said, \""Immel did
it!\"""})--><br>
>>>>><br>
>>>>> Node/X3DJSAIL generated XML code:<br>
>>>>><br>
>>>>> <!-- alternative Java source:
.setString(new String [] {"One, Two, <br>
>>>>> Comment", "", "He said, \""Immel did
it!\"""}) --><br>
>>>>><br>
>>>>><br>
>>>>> It looks like whatever's generating
JSON is producing extra <br>
>>>>> quotes, and that's spreading to other
code. X3dToJson.xslt???<br>
>>>>><br>
>>>>> Don do you have any code downstream
from X3dToJson.xslt? Everit? <br>
>>>>> Can we get rid of the extra quotes in
JSON? Thanks!<br>
>>>>><br>
>>>>> Test harness (minus old versions of
python) results below:<br>
>>>>><br>
>>>>> $ bash several.sh
../data/HelloWorldProgramOutputCanonical.x3d<br>
>>>>> BEGIN
../data/HelloWorldProgramOutputCanonical.x3d > json,
Script <br>
>>>>> DEF=colorTypeConversionScript contains
CDATA source-code text, <br>
>>>>> copied as "#sourceText" using "strings"
mode<br>
>>>>> Script DEF=MaterialModulatorScript
contains CDATA source-code <br>
>>>>> text, copied as "#sourceText" using
"strings" mode<br>
>>>>> END
../data/HelloWorldProgramOutputCanonical.x3d<br>
>>>>>
================================================================================
<br>
>>>>><br>
>>>>>
/home/coderextreme/X3DJSONLD/src/main/node/xmldiff.js <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.x3d <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.x3d.new<br>
>>>>> @5
/X3D/Scene/0/NavigationInfo/0/$/avatarSize<br>
>>>>> < "0.25 1.6 0.75"<br>
>>>>> @5
/X3D/Scene/0/NavigationInfo/0/$/transitionType<br>
>>>>> < "\"LINEAR\""<br>
>>>>> @5 /X3D/Scene/0/LayerSet/0/$/order<br>
>>>>> < "0"<br>
>>>>>
@6/X3D/Scene/0/Transform/0/Anchor/0/Shape/0/Appearance/0/ImageTexture/0/$/containerField
<br>
>>>>><br>
>>>>> >"texture"<br>
>>>>>
@6/X3D/Scene/0/Transform/0/Anchor/0/Shape/0/Box/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>>
@6/X3D/Scene/0/Transform/1/Shape/0/Text/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>>
@6/X3D/Scene/0/Transform/1/Shape/0/Text/0/MetadataSet/0/$/containerField
<br>
>>>>><br>
>>>>> >"metadata"<br>
>>>>> @4 <br>
>>>>>
/X3D/Scene/0/Transform/1/Shape/0/Text/0/MetadataSet/0/MetadataString/1/$/containerField<br>
>>>>> < "value"<br>
>>>>> @5
/X3D/Scene/0/Transform/1/Shape/0/Text/0/FontStyle/0/$/family<br>
>>>>> < "\"SERIF\""<br>
>>>>>
@6/X3D/Scene/0/Transform/1/Collision/0/Shape/0/Text/0/$/containerField
<br>
>>>>><br>
>>>>> >"geometry"<br>
>>>>>
@6/X3D/Scene/0/Shape/0/IndexedLineSet/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>>
@6/X3D/Scene/0/Shape/0/IndexedLineSet/0/Coordinate/0/$/containerField<br>
>>>>> >"coord"<br>
>>>>>
@6/X3D/Scene/0/Shape/1/Sphere/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>>
@6/X3D/Scene/0/Shape/2/Cone/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>>
@6/X3D/Scene/0/Shape/3/Cylinder/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>>
@6/X3D/Scene/0/Shape/4/Extrusion/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>>
@7/X3D/Scene/0/Shape/5/Appearance/0/ProgramShader/0/ShaderProgram/0/$/type
<br>
>>>>><br>
>>>>> >"VERTEX"<br>
>>>>> @4
/X3D/Scene/0/Shape/5/Appearance/0/ProtoInstance/0/$/containerField<br>
>>>>> < "shaders"<br>
>>>>>
@7/X3D/Scene/0/Shape/5/Appearance/0/ComposedShader/0/ShaderPart/0/$/type
<br>
>>>>><br>
>>>>> >"VERTEX"<br>
>>>>> @1 /X3D/Scene/0/Group/0/Script/0/_
/X3D/Scene/0/Group/0/Script/0/_<br>
>>>>> < "\n \n \n
\necmascript:\n\nfunction colorInput <br>
>>>>> (eventValue) // Example source
code\n{\n colorsOutput = new <br>
>>>>> MFColor(eventValue); // assigning value
sends output event\n// <br>
>>>>> Browser.print('colorInput=' +
eventValue + ', colorsOutput=' + <br>
>>>>> colorsOutput + '\\n');\n}\n\n "<br>
>>>>> > "\n\necmascript:\r\n\r\nfunction
colorInput (eventValue) // <br>
>>>>> Example source code\r\n{\r\n
colorsOutput = new <br>
>>>>> MFColor(eventValue); // assigning value
sends output event\r\n// <br>
>>>>> Browser.print('colorInput=' +
eventValue + ', colorsOutput=' + <br>
>>>>> colorsOutput + '\\n');\r\n}"<br>
>>>>>
@6/X3D/Scene/0/Group/1/Shape/0/MetadataString/0/$/containerField<br>
>>>>> >"metadata"<br>
>>>>>
@6/X3D/Scene/0/Group/1/Shape/0/Cone/0/$/containerField<br>
>>>>> >"geometry"<br>
>>>>> @1
/X3D/Scene/0/ProtoDeclare/1/ProtoBody/0/Script/0/_ <br>
>>>>>
/X3D/Scene/0/ProtoDeclare/1/ProtoBody/0/Script/0/_<br>
>>>>> < "\n \n
\n \n \n \n <br>
>>>>> \necmascript:\nfunction initialize
()\n{\n newColor = <br>
>>>>> diffuseColor; // start with correct
color\n}\nfunction set_enabled <br>
>>>>> (newValue)\n{\n\tenabled =
newValue;\n}\nfunction clockTrigger <br>
>>>>> (timeValue)\n{\n if (!enabled)
return;\n red = newColor.r;\n <br>
>>>>> green = newColor.g;\n blue =
newColor.b;\n \n // note <br>
>>>>> different modulation rates for each
color component, % is modulus <br>
>>>>> operator\n newColor = new SFColor
((red + 0.02) % 1, (green + <br>
>>>>> 0.03) % 1, (blue + 0.04) % 1);\n\tif <br>
>>>>> (enabled)\n\t{\n\t\tBrowser.print
('diffuseColor=(' + red + ',' + <br>
>>>>> green + ',' + blue + ') newColor=' +
newColor.toString() + <br>
>>>>> '\\n');\n\t}\n}\n\n "<br>
>>>>> >
"\n\n\n\n\necmascript:\r\nfunction initialize ()\r\n{\r\n <br>
>>>>> newColor = diffuseColor; // start with
correct <br>
>>>>> color\r\n}\r\nfunction set_enabled
(newValue)\r\n{\r\n\tenabled = <br>
>>>>> newValue;\r\n}\r\nfunction clockTrigger
(timeValue)\r\n{\r\n if <br>
>>>>> (!enabled) return;\r\n red =
newColor.r;\r\n green = <br>
>>>>> newColor.g;\r\n blue =
newColor.b;\r\n\r\n // note <br>
>>>>> different modulation rates for each
color component, % is modulus <br>
>>>>> operator\r\n newColor = new SFColor
((red + 0.02) % 1, (green + <br>
>>>>> 0.03) % 1, (blue + 0.04) % 1);\r\n\tif
<br>
>>>>> (enabled)\r\n\t{\r\n\t\tBrowser.print
('diffuseColor=(' + red + <br>
>>>>> ',' + green + ',' + blue + ')
newColor=' + newColor.toString() + <br>
>>>>> '\\n');\r\n\t}\r\n}"<br>
>>>>>
@6/X3D/Scene/0/Sound/0/AudioClip/0/$/containerField<br>
>>>>> >"source"<br>
>>>>><br>
>>>>> Different<br>
>>>>>
~/X3DJSONLD/src/main/java/net/coderextreme/data <br>
>>>>> ~/X3DJSONLD/src/main/shell<br>
>>>>>
../java/net/coderextreme/data/HelloWorldProgramOutputCanonical.java<br>
>>>>> ~/X3DJSONLD/src/main/shell<br>
>>>>> ~/X3DJSONLD/src/main/java
~/X3DJSONLD/src/main/shell<br>
>>>>>
net/coderextreme/data/HelloWorldProgramOutputCanonical<br>
>>>>> WARNING_MESSAGE: ProtoInstance
name='ShaderProto' <br>
>>>>> DEF='TestShader3' USE='' is missing
containerField relationship to <br>
>>>>> parent node, assuming
containerField='shaders' from initial node <br>
>>>>> in corresponding ProtoDeclare. Need to
fix ProtoInstance <br>
>>>>> definition in model source.<br>
>>>>> Note:
toFileStylesheetConversion(X3dToJson.xslt) is overwriting <br>
>>>>> prior file
../data/HelloWorldProgramOutputCanonical.new.json<br>
>>>>> Script DEF=colorTypeConversionScript
contains CDATA source-code <br>
>>>>> text, copied as "#sourceText" using
"strings" mode<br>
>>>>> Script DEF=MaterialModulatorScript
contains CDATA source-code <br>
>>>>> text, copied as "#sourceText" using
"strings" mode<br>
>>>>> ~/X3DJSONLD/src/main/shell<br>
>>>>>
================================================================================
<br>
>>>>><br>
>>>>>
/home/coderextreme/X3DJSONLD/src/main/node/jsondiff.js <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.json <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.new.json<br>
>>>>> @2 <br>
>>>>>
/X3D/Scene/-children/13/Transform/-children/1/Collision/-proxy/Shape/-children/2/#comment/12/0
<br>
>>>>>
/X3D/Scene/-children/13/Transform/-children/1/Collision/-proxy/Shape/-children/2/#comment/12/0
<br>
>>>>><br>
>>>>> < "\\\"\"Immel"<br>
>>>>> > "\\\"\"\"Immel"<br>
>>>>> @2 <br>
>>>>>
/X3D/Scene/-children/13/Transform/-children/1/Collision/-proxy/Shape/-children/2/#comment/14/0
<br>
>>>>>
/X3D/Scene/-children/13/Transform/-children/1/Collision/-proxy/Shape/-children/2/#comment/14/0
<br>
>>>>><br>
>>>>> < "it!\\\"\"\"})"<br>
>>>>> > "it!\\\"\"\"\"})"<br>
>>>>><br>
>>>>> Different<br>
>>>>> ~/X3DJSONLD/src/main/node
~/X3DJSONLD/src/main/shell<br>
>>>>>
../node/net/coderextreme/data/HelloWorldProgramOutputCanonical.js<br>
>>>>> Warning:
../data/HelloWorldProgramOutputCanonical.new.x3d does not <br>
>>>>> meet suggested X3D naming conventions,
continuing...<br>
>>>>> WARNING_MESSAGE: ProtoInstance
name='ShaderProto' <br>
>>>>> DEF='TestShader3' USE='' is missing
containerField relationship to <br>
>>>>> parent node, assuming
containerField='shaders' from initial node <br>
>>>>> in corresponding ProtoDeclare. Need to
fix ProtoInstance <br>
>>>>> definition in model source.<br>
>>>>> Note: toFileX3D() is overwriting prior
file <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.new.x3d<br>
>>>>> ~/X3DJSONLD/src/main/shell<br>
>>>>> node
/home/coderextreme/X3DJSONLD/src/main/node/xmldiff.js <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.x3d <br>
>>>>>
../data/HelloWorldProgramOutputCanonical.new.x3d<br>
>>>>><br>
>>>>><br>
>>>>>
_______________________________________________<br>
>>>>> x3d-public mailing list<br>
>>>>> <a href="mailto:x3d-public@web3d.org"
target="_blank" moz-do-not-send="true">x3d-public@web3d.org</a><br>
>>>>> <a
href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
>>>>><br>
>>>><br>
>>>> all the best, Don<br>
</blockquote>
</div>
</div>
</blockquote>
</body>
</html>