[x3d-public] Broken X3dToJava.xslt stylesheet

Don Brutzman brutzman at nps.edu
Sun Apr 9 12:16:15 PDT 2017


As it turns out I was working on this exact issue yesterday and made some improvements.

Please see the following result:

	X3DJSAIL: Examples
	http://www.web3d.org/specifications/java/X3DJSAIL.html#Examples

	HelloWorldProgramOutput.java source-code serialization
	http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.java

So much of this might be sorted out.  I specifically removed the ProtoInstance utility constructor that supported a single string for prototypeName because that was contrary to other utility constructors for nodes that instead accept DEFname.  Instead, the only ProtoInstance utility constructor requires both DEFname and prototypeName (in that order) for uniqueness.

Apologies if that requires a little converter correction, but this mixed-message method signature could have led to painful mistakes, and so have gone ahead with changing it.  Updated build posted last night.

Anyway, HelloWorldProgramOutput.java is compiling now.  The self-test when running still throws a run-time exception that shows the evolution of the error you have identified.  This is possibly due to the program pattern as well as the library, will continue unit-testing both.

===============================================================================================================
run:
Exception in thread "main" org.web3d.x3d.sai.InvalidFieldException: Illegal addFieldValue() invocation for ProtoInstanceObject name='ArtDeco01' fieldValue name='description', newFieldValue.validation() failure:
    ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.

	at org.web3d.x3d.jsail.Core.ProtoInstanceObject.addFieldValue(ProtoInstanceObject.java:1112)
	at HelloWorldProgramOutput.initialize(HelloWorldProgramOutput.java:238)
	at HelloWorldProgramOutput.<init>(HelloWorldProgramOutput.java:128)
	at HelloWorldProgramOutput.main(HelloWorldProgramOutput.java:373)
===============================================================================================================


On 4/9/2017 4:46 AM, yottzumm at gmail.com wrote:
> This might be a better diff to fix against.  I am not sure.
>
>
>
> diff HelloWorldProgramOutput.old.java HelloWorldProgramOutput.java
>
> 176c176
>
> <           .setGeometry(new BoxObject("test-NMTOKEN_regex.0123456789").setClass("textured")))))
>
> ---
>
>>           .setGeometry(new BoxObject("test-NMTOKEN_regex.0123456789").setCssClass("textured")))))
>
> 284c284
>
> <           .setMaterial(new ProtoInstanceObject("MyMaterialModulator").setDEF("MyMaterialModulator").setName("MaterialModulator"))
>
> ---
>
>>           .setMaterial(new ProtoInstanceObject("MyMaterialModulator", "MaterialModulator"))
>
> 289,293c289
>
> <     .addComments(" Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance DEF='DeclarativeAppearanceExample'/> i.e.
>
> < <Appearance DEF='DeclarativeAppearanceExample'>
>
> <     <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/>
>
> <     <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - ->
>
> < </Appearance> ")
>
> ---
>
>>     .addComments(" Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance DEF='DeclarativeAppearanceExample'/> i.e.  <Appearance DEF='DeclarativeAppearanceExample'> <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/> <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - -> </Appearance> ")
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>
>
>
> *From: *yottzumm at gmail.com <mailto:yottzumm at gmail.com>
> *Sent: *Sunday, April 9, 2017 7:10 AM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>; Roy Walmsley <mailto:roy.walmsley at ntlworld.com>; X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *Broken X3dToJava.xslt stylesheet
>
>
>
>
>
> I had to make the following changes to HelloWorldProgramOutput.java to make it compile.    The stylesheet doesn’t produce valid Java.
>
>
>
> diff HelloWorldProgramOutput.old.java HelloWorldProgramOutput.java
>
> 176c176
>
> <           .setGeometry(new BoxObject("test-NMTOKEN_regex.0123456789").setClass("textured")))))
>
> ---
>
>>           .setGeometry(new BoxObject("test-NMTOKEN_regex.0123456789").setCssClass("textured")))))
>
> 284c284
>
> <           .setMaterial(new ProtoInstanceObject("MyMaterialModulator").setDEF("MyMaterialModulator").setName("MaterialModulator"))
>
> ---
>
>>           .setMaterial(new ProtoInstanceObject().setName("MyMaterialModulator").setDEF("MyMaterialModulator").setName("MaterialModulator"))
>
> 289,293c289
>
> <     .addComments(" Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance DEF='DeclarativeAppearanceExample'/> i.e.
>
> < <Appearance DEF='DeclarativeAppearanceExample'>
>
> <     <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/>
>
> <     <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - ->
>
> < </Appearance> ")
>
> ---
>
>>     .addComments(" Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance DEF='DeclarativeAppearanceExample'/> i.e.  <Appearance DEF='DeclarativeAppearanceExample'> <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/> <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - -> </Appearance> ")
>
> In addition, the result program doesn’t pass muster when running it:
>
>
>
> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldException: Illegal addFieldValue() invocation for ProtoInstanceObject name='ArtDeco01' fieldValue name='description', newFieldValue.validation() failure:
>
>    ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
> ErrorNotConnectedToSceneGraph, fieldValue is not connected to a scene graph and thus getType() cannot be checked.
>
>
>
>         at org.web3d.x3d.jsail.Core.ProtoInstanceObject.addFieldValue(ProtoInstanceObject.java:1112)
>
>         at HelloWorldProgramOutput.initialize(HelloWorldProgramOutput.java:238)
>
>         at HelloWorldProgramOutput.<init>(HelloWorldProgramOutput.java:128)
>
>         at HelloWorldProgramOutput.main(HelloWorldProgramOutput.java:369)
>
>
>


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



More information about the x3d-public mailing list