<div dir="auto"><div>What I'm trying to do: add an MFNode or SFNode typed field to a ProtoInterface with addField().  If this is not the right thing to do, let me know.   Apparently, when you add the field, it validates it, then calls setValue.   SetValue is not the right thing to call for a SFNode or MFNode, afaik.   I am just reading the error message and not the X3DJSAIL code.</div><div dir="auto"><br></div><div dir="auto">I hope this helps!</div><div dir="auto"><br></div><div dir="auto">BTW, if you want to use my JavaSerializer.js, I should be able to give you any license you want.   It's currently licensed with a BSD license.   It does the job of DOM -> Java program   Obviously a rewrite in Java is desirable, especially the mapToMethod could be improved.  If you are going to write something using reflection, I encourage you to provide an output Java version for source code control.</div><div dir="auto"><br></div><div dir="auto">Oh, and I heartily disagree with creating a Java version by hand :).  It will likely get blown away next time I convert from JSON.  I regularly remove all java files except the for those used by running the X3dToJson.xslt</div><div dir="auto"><br></div><div dir="auto">You probably have an attachment with abox.json in it, but I will try to provide a copy.</div><div dir="auto">John<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Feb 15, 2017 12:32 PM, "Don Brutzman" <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On 2/14/2017 8:08 PM, <a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Don,<br>
<br>
Are you requiring the Java 8 syntax for X3DJSAIL application programmers?  Thanks!<br>
</blockquote>
<br></div>
No restrictions.  The declarative approach is an interesting style and no backwards compatibility with classical programming practice is sacrificed.<br>
<br>
also: Thank You for continuing reports such as the following, John.  i first need to get out of "tall grass" of DOM + Java Reflection but will keep getting back to these and sorting each one out, they are very important.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
*From: *<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a> <mailto:<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>><br>
*Sent: *Tuesday, February 14, 2017 11:00 PM<br>
*To: *Don Brutzman <mailto:<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>; Roy Walmsley <mailto:<a href="mailto:roy.walmsley@ntlworld.com" target="_blank">roy.walmsley@ntlworld.<wbr>com</a>>; X3D Graphics public mailing list <mailto:<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
*Subject: *X3DJSAIL. Use of fields in ProtoInterface. addField() no longerworks.<div class="quoted-text"><br>
<br>
Please provide example of calling setChildren() with multiple field objects, or perhaps allow addChildren().  Haven’t spent too much time on this, addChildren() may work.  Perhaps fix addField() to allow MFNode and SFNode, or remove from API??  Have validate call setChildren or addChildren for MFNodes and SFNodes?  Many choices here. Modify fieldObject to not throw an exception of addChildren() is called on fieldObject?<br>
</div></blockquote>
<br>
preliminary answer: please see the HelloWorldProgram.java for many example invocations.<br>
<br>
secondary answer:  the pre-existing Java SAI interfaces are sometimes more restrictive that we might hope.  Working document to keep track of issues at<br>
<br>
        <a href="http://www.web3d.org/specifications/java/X3dJavaSceneAuthoringInterface.html#SpecificationChanges" rel="noreferrer" target="_blank">http://www.web3d.org/specifica<wbr>tions/java/X3dJavaSceneAuthori<wbr>ngInterface.html#<wbr>SpecificationChanges</a><br>
<br>
        <a href="http://www.web3d.org/specifications/java/X3dJavaSpecificationChangesAndIssues.txt" rel="noreferrer" target="_blank">http://www.web3d.org/specifica<wbr>tions/java/X3dJavaSpecificatio<wbr>nChangesAndIssues.txt</a><br>
<br>
third answer: have been experimenting with JSAIL utility methods, such as pipelined addChild which can be easier to use sometimes.<br>
<br>
        <a href="http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Grouping/GroupObject.html#addChild-org.web3d.x3d.sai.Core.X3DChildNode-" rel="noreferrer" target="_blank">http://www.web3d.org/specifica<wbr>tions/java/javadoc/org/web3d/<wbr>x3d/jsail/Grouping/GroupObject<wbr>.html#addChild-org.web3d.x3d.<wbr>sai.Core.X3DChildNode-</a><br>
<br>
fourth answer: protos are especially tricky but definitely converging to meet use cases.  work in progress, let's keep pushing!!  8)<div class="quoted-text"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Abox.java (attached)<br>
<br>
Exception in thread "main" org.web3d.x3d.sai.InvalidProto<wbr>Exception: field name='myShape' with type='MFNode' cannot have any simple-type value (newValue='').  Use setChildren() method instead.<br>
<br>
        at org.web3d.x3d.jsail.Core.field<wbr>Object.setValue(fieldObject.<wbr>java:770)<br>
        at org.web3d.x3d.jsail.Core.field<wbr>Object.validate(fieldObject.<wbr>java:1044)<br>
        at org.web3d.x3d.jsail.Core.Proto<wbr>InterfaceObject.addField(Proto<wbr>InterfaceObject.java:466)<br>
        at abox.main(abox.java:88)<br>
</blockquote>
<br></div>
not quite understanding what you are trying to do here...<br>
<br>
suggested approach:<br>
- you will hopefully find an existing pattern (or TODO comment) in HelloWorldProgram<br>
- show regular-encoding version of your goal scene for understanding (.x3d or .json or .x3dv or .wrl)<br>
- let's build the java manually to match, once understood then go for the pattern<div class="quoted-text"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I noted the change to the package structure.<br>
</blockquote>
<br></div>
glad to hear, again thanks.<br>
<br>
all the best, Don<font color="#888888"><br>
-- <br>
Don Brutzman  Naval Postgraduate School, Code USW/Br       <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><br>
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   <a href="tel:%2B1.831.656.2149" value="+18316562149" target="_blank">+1.831.656.2149</a><br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">http://faculty.nps.edu/brutzma<wbr>n</a><br>
</font></blockquote></div><br></div></div></div>