[x3d-public] good example for ECMAScripting and Protos?

John Carlson yottzumm at gmail.com
Thu Aug 2 10:03:13 PDT 2018


Yes, adding a CDATA section fixed the #sourceText.

Any comments on whether I should check for text nodes when processing scripts?

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Thursday, August 2, 2018 12:55 PM
To: vmarchetti at kshell.com
Cc: X3D-Public
Subject: Re: [x3d-public] good example for ECMAScripting and Protos?

It does check for nodeType === 4 before processing sourceText when running DOM2JSONSerializer.  Worth a shot.

On Thu, Aug 2, 2018 at 7:34 AM vmarchetti at kshell.com <vmarchetti at kshell.com> wrote:
John

I do see that of the files you attrached, SphereDirectedPointSet.new.json does not have the Script source in the json structure, while the other two files do. You didn't mention what X3D->JSON method was used to generate each of your three files.

I can confirm that the X3D->JSON conversion in X3D-Edit (running in NetBeans 8.1) works -- includes the Script source --  , and  a conversion using the X3dToJson.xslt stylesheet and the SaxonHE 9.7 XSLT 2 engine also works.

However, the Xj3D browser does throw an error reading the SphereDirectedPointSet.x3d; flags the entire source text of t Script node as an unrecognized field value.
Perhaps it needs to be enclosed in CDATA ?

Vince



On Aug 2, 2018, at 3:20 AM, John Carlson <yottzumm at gmail.com> wrote:

Note:  I was loading XML and it’s being converted to JSON.

On Thu, Aug 2, 2018 at 3:09 AM John Carlson <yottzumm at gmail.com> wrote:
Here are three JSON files produced by X3DJSONLD.  Two are produced by DOM2JSONSerializer.json, and one is produced by X3dToJson.xslt.  Can anyone see perhaps why the one without #sourceText got messed up?
 
Curious.
 
John
 
Sent from Mail for Windows 10
 
From: John Carlson
Sent: Thursday, August 2, 2018 12:37 AM

To: vmarchetti at kshell.com; X3D-Public
Subject: RE: [x3d-public] good example for ECMAScripting and Protos?
 
Well, when I run the conversions from the command line, there’s a #sourceText.  IDK what’s happening, except I remove the Scripts from the XML, after sending to the browsers. The only thing I can conclude is that they are being converted back to JSON.  But no other file does the same thing that I’ve found. Hmm.
 
John
 
Sent from Mail for Windows 10
 
From: John Carlson
Sent: Thursday, August 2, 2018 12:32 AM
To: vmarchetti at kshell.com; X3D-Public
Subject: RE: [x3d-public] good example for ECMAScripting and Protos?
 
Vince, I’m trying to identify why the file you give does not have #sourceText when converted to JSON.   Can you try with X3D-edit?
 
I will pursue this some.
 
John
 
Sent from Mail for Windows 10
 
From: vmarchetti at kshell.com
Sent: Wednesday, August 1, 2018 9:04 PM
To: John Carlson; X3D-Public
Subject: Re: [x3d-public] good example for ECMAScripting and Protos?
 
See 
http://www.kshell.com/pages/pointcloudvisualization/SphereDirectedPointSet.x3d
 
It is a X3D file with with a Prototype + ecmascript definition of a point cloud, with a vector attached to each point of the cloud.
Example used is just points randomly distributed on sphere with directs pointed radially outward.
 
Potential uses would be to implement the scanning design pattern at http://x3dgraphics.com/examples/X3dForAdvancedModeling/Scanning/X3dMeshDesignPatternIndex.html , or
visualizing fluid flow or  electromagnetic field
 
On Jul 31, 2018, at 10:30 PM, John Carlson <yottzumm at gmail.com> wrote:
 
Is there a good example of ECMAScripting in X3D that I can use to test my X3D JSON ECMAScript preprocessor?  Preferably with Protos 
 
 
Thanks!
 
John
 
_______________________________________________
x3d-public mailing list
x3d-public at web3d.org
http://web3d.org/mailman/listinfo/x3d-public_web3d.org
 
 
 
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180802/6257bc14/attachment-0001.html>


More information about the x3d-public mailing list