[X3D-Public] [x3dom-developers] initial X3D JSON conversion support using X3dToJson.xslt

Don Brutzman brutzman at nps.edu
Thu Oct 9 22:17:14 PDT 2014


Thanks John.  I had a mistaken understanding when saying conversion to numbers wasn't possible - now corrected.

Big picture for programmers unfamiliar with XSLT:
a.  XSLT can take any XML input, and then turn it into either XML or some other text output.
b. Even though XSLT stylesheets look somewhat verbose, it has a small vocabulary (so there isn't much to learn compared to other programming languages).
c. Since it is written using XML, a lot of potential programming errors are instantly eliminated through XML validation.
d. Execution is REALLY fast, even on very large XML input files.

So, in effect, this XSLT stylesheet is simply converting a .x3d scene (written in XML) by walking the scene-graph tree and outputting plain-text JSON syntax.

The syntactic choices are a bit tricky, as this thread shows, but the results are not complex.

Tuning the results to best match JSON to Javascript use of X3D scene graphs will hopefully add a lot of performance and interoperability benefits.  So this is a worthy community effort and all contributions remain welcome.

Of course other tools accomplishing the exact same task will be welcome too.  Viva interoperability.

On 10/9/2014 7:45 AM, John Carlson wrote:
> The reason I say this is because Don said converting to numbers isn't possible.   Would it be possible to write an xslt set of functions which converted strings to arrays or numbers?

yes, that is the exact nature of the programming task, answered in more detail in preceding reply to Johannes.

> On Oct 9, 2014 9:41 AM, "John Carlson" <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>
>     Perhaps we need to extend xslt to support json?

again thanks.

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