[x3d-public] X3DJSAIL: Interesting exception, but it could be myfault.Re:CommentsBlock.

John Carlson yottzumm at gmail.com
Tue May 23 20:55:50 PDT 2017


Here’s an untested stylesheet with the diffs which you can test with my Java code which I just sent.  I will have to do a build and retest my code.  Will do.  I cannot test against your code because your code does not produce output.  You will have to test.

John

Here are the diffs between the stylesheets as well:


Sent from Mail for Windows 10

From: Don Brutzman
Sent: Tuesday, May 23, 2017 8:14 PM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: X3DJSAIL: Interesting exception, but it could be myfault.Re:CommentsBlock.

On 5/22/2017 10:47 PM, John Carlson wrote:
> For example, Look at the MFStringObjects in this file.

online via

http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamplesIndex.html

==============================
.x3d
         <Text string='"He said, \"Immel did it!\""'/>
         <!-- alternative: Text string='"He said, \"Immel did it!\""' -->

.java
         .setGeometry(new TextObject().setString(new MFStringObject("\"He said, \\\"Immel did it!\\\"\"")))

         .addComments(" alternative: Text string='\"He said, \\"Immel did it!\\"\"' ")

==============================
.json
"-children":[
   {
	"#comment":"note that Collision proxy Shape is not rendered"
   },
   {
	"#comment":"alternative: Text string='\"He said, \\"Immel did it!\\"\"'"
   }
],
"-geometry":
   { "Text":
	{
	  "@string":["He said, \"Immel did it!\""]
	}
   },
==============================

> First off, they aren’t arrays.

For the Java, there are multiple ways to create an MFString using X3DJSAIL.  Your preference may vary.

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Text/TextObject.html#method.summary

TextObject has multiple setters for the Text @string field:

	setString(java.util.ArrayList<java.lang.String> newValue)
  
	setString(MFStringObject newValue)

	setString(SFStringObject newValue)

	TextObject 	setString(java.lang.String newValue)

	TextObject 	setString(java.lang.String[] newValue)

Further there are mutliple ways to create an SFStringObject and MFStringObject; 4 constructors and 6 setValue methods each.

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFStringObject.html
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/MFStringObject.html

This flexibility makes it easy for java programmers to use whichever data structure they prefer, seldom needing to do their own data conversion (which can be error prone), with strong typing for unambiguous results.

> Secondly, they have a awful lot of \’s
> 
> John

XML .x3d: must escape quote as \"

.java:	must escape backslash as \\ and quote as \" which results in \\\"

.json:	must escape quote as " as \" or \"

note that comments are a little different because they are not SF/MFStrings but just text.  So " does not require extra backslash character(s).

I think it is just fine if you are producing X3D -> .java that is a little different, as long as we get correct/consistent results.


> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *John Carlson <mailto:yottzumm at gmail.com>
> *Sent: *Tuesday, May 23, 2017 12:56 AM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *RE: X3DJSAIL: Interesting exception, but it could be my fault.Re:CommentsBlock.
> 
> Don, be sure the quotes, escapes etc in the Java generated from these files is what we want.  Also test all the way through X3DJSAIL and compare X3D output to X3D input.
> 
> 
> I gotta get something to eat.
> 
> Thanks,
> 
> John
> 
> Attached.
> 
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *Don Brutzman <mailto:brutzman at nps.edu>
> *Sent: *Monday, May 22, 2017 11:47 PM
> *To: *John Carlson <mailto:yottzumm at gmail.com>
> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *Re: X3DJSAIL: Interesting exception, but it could be my fault. Re:CommentsBlock.
> 
> On 5/21/2017 2:01 AM, Don Brutzman wrote:
> 
>  > these are fixed but there is still a gap in the chain when nested protoypes occur.  not a CommentsBlock problem.
> 
> Those issues are now fixed.  Build report:  improved handling of ProtoInstance getNodeByDEF, getFieldType, getAccessType plus additional utility methods.
> 
> =================================================================================================================
> 
> ProtoInstance utility methods
> 
> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/ProtoInstanceObject.html#method.summary
> 
> hasExternProtoDeclare()
> 
> Determine whether a corresponding ExternProtoDeclare with same name is connected in this scene graph.
> 
> hasProtoDeclare()
> 
> Determine whether a corresponding ProtoDeclare with same name is connected in this scene graph.
> 
> getExternProtoDeclare()
> 
> Provide corresponding ExternProtoDeclare with same name if connected in this scene graph.
> 
> getProtoDeclare()
> 
> Provide corresponding ProtoDeclare with same name if connected in this scene graph.
> 
> =================================================================================================================
> 
> As a result, test shows support is included for nested ProtoInstance nodes.  Example attached, updated X3DJSAIL deployed.
> 
> These corrections fix some "false negative" warnings on ROUTEs in the archives.  I'll rerun all Java examples tonight to clean them up.
> 
>  > On 5/20/2017 7:02 PM, John Carlson wrote:
> 
>  >> Have not triaged.  Code is attached.  And so is XML
> 
>  >>
> 
>  >> org.web3d.x3d.sai.InvalidProtoException: ExternProtoDeclare name='CameraShot' with field name='moves' cannot have any initial value (found "[org.web3d.x3d.jsail.Core.CommentsBlock at 5cb0d902]"). Instead use ProtoInstance fieldValue to override the original default ProtoDeclare field value.
> 
>  >>
> 
>  >> org.web3d.x3d.sai.InvalidProtoException: ExternProtoDeclare name='CameraShot' with field name='moves' cannot have any initial value (found "[org.web3d.x3d.jsail.Core.CommentsBlock at 5cb0d902]"). Instead use ProtoInstance fieldValue to override the original default ProtoDeclare field value.
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.ExternProtoDeclareObject.setFieldList(ExternProtoDeclareObject.java:331)
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.ExternProtoDeclareObject.validate(ExternProtoDeclareObject.java:842)
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.SceneObject.validate(SceneObject.java:626)
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.X3DObject.validate(X3DObject.java:1880)
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(X3DObject.java:750)
> 
>  >>
> 
>  >>          at net.coderextreme.data.CameraExamples.main(CameraExamples.java:80)
> 
>  >>
> 
>  >> Exception in thread "main" org.web3d.x3d.sai.InvalidProtoException: ExternProtoDeclare name='CameraShot' with field name='moves' cannot have any initial value (found "[org.web3d.x3d.jsail.Core.CommentsBlock at 5cb0d902]"). Instead use ProtoInstance fieldValue to override the original default ProtoDeclare field value.
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.ExternProtoDeclareObject.setFieldList(ExternProtoDeclareObject.java:331)
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.ExternProtoDeclareObject.validate(ExternProtoDeclareObject.java:842)
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.SceneObject.validate(SceneObject.java:626)
> 
>  >>
> 
>  >>         at org.web3d.x3d.jsail.Core.X3DObject.validate(X3DObject.java:1880)
> 
>  >>
> 
>  >>          at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(X3DObject.java:750)
> 
>  >>
> 
>  >>          at net.coderextreme.data.CameraExamples.main(CameraExamples.java:80)
> 
>  >>
> 
>  >
> 
>  >
> 
>  > all the best, Don
> 
> all the best, Don
> 
> -- 
> 
> Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
> 
> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
> 
> X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170523/7db67b3e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Create.diff
Type: application/octet-stream
Size: 3283 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170523/7db67b3e/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CreateX3dSceneAccessInterfaceJava.xslt
Type: application/octet-stream
Size: 1250611 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170523/7db67b3e/attachment-0003.obj>


More information about the x3d-public mailing list