[x3d-public] Fixing DOM2JSONSerializer.js [Fixed!]

John Carlson yottzumm at gmail.com
Mon Mar 19 09:28:00 PDT 2018


This was successfully fixed.  I reverted my comments back to strings, and comparing X3dToJson.xslt and DOM2JSONSerializer.json output, they are similar, except for #sourceText, which Don needs to fix in X3dToJson.xslt.

So I am announcing the immediate availability of DOM2JSONSerializer.js, the first DOM to X3D JSON converter which works in web browsers!

https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/DOM2JSONSerializer.js

usage:

cd X3DJSONLD/src/main/node

node xml2all.js ../data/file1.x3d ../data/file2.x3d …

output should be in .../data/file1.json ../data/file2.json …

John

Note that I have changed my Prototype Expander and different files succeed/fail  I will work on that next.

Sent from Mail for Windows 10

From: John Carlson
Sent: Monday, March 19, 2018 7:05 AM
To: X3D Graphics public mailing list
Subject: Fixing DOM2JSONSerializer.js

So I've been trying to think how to solve the fieldValue type (arrays, booleans being treated like SFStrings) problems in DOM2JSON Serializer.   I know I have to find the type in the field declaration.  Which is stored in the ProtoDeclare and ExternProtoDeclare.   So it should be easy to find the Protos by name, except in the case where there's a USE in a prototype instance, in that case, I have to look for a DEF first.   And I have to handle scoping.   This seems like a job for the ProtoExpander, but I'm pretty sure I don't want the whole thing.

Any thoughts about making it inline versus a postprocess?

John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180319/5ebf2f34/attachment.html>


More information about the x3d-public mailing list