[X3D-Public] [x3dom-developers] initial X3D JSON conversion support using X3dToJson.xslt
Behr, Johannes
johannes.behr at igd.fraunhofer.de
Thu Oct 9 11:02:03 PDT 2014
On 9 Oct 2014, at 16:45, John Carlson <yottzumm at gmail.com> wrote:
> The reason I say this is because Don said converting to numbers isn't possible. Would it be possible to write and xslt set of functions which converted strings to arrays or numbers?
How is the X3D-Classic encoding done right now?
Best regards
Johannes
>
> On Oct 9, 2014 9:41 AM, "John Carlson" <yottzumm at gmail.com> wrote:
> Perhaps we need to extend xslt to support json?
>
> On Oct 9, 2014 9:35 AM, "Jung, Yvonne" <yvonne.jung at igd.fraunhofer.de> wrote:
> +1 for Johannes' proposal -- keep it simple and don't think XML-ish.
> And as already said before: this way, you can directly call JSON.parse() to gen objects.
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: X3D-Public [mailto:x3d-public-bounces at web3d.org] Im Auftrag von doug
> > sanden
> > Gesendet: Donnerstag, 9. Oktober 2014 15:49
> > An: x3d-pulbic mlist
> > Betreff: Re: [X3D-Public] [x3dom-developers] initial X3D JSON conversion
> > support using X3dToJson.xslt
> >
> >
> > I concur with Johannes on the A) no-defaults and D) explicit child placement (vs
> > containerFeild), on the design principle "Noise reduction helps adoption".
> > -Doug
> > more..
> > Remember classic / vrml format could explicitly place child fields in the parent
> > node. It was X3D via xml that needed containerField to disambiguate what field
> > a child xml element was intended for in the parent node, when it wasn't
> > obvious (example externProtoDeclares of appearance or shape). I haven't
> > studied JSON, but if it doesn't have a problem - if it has syntax for directly
> > placing SF and MFnode children in parent node fields like vrml classic did- then
> > containerField is theoretically un-necessary. In practice, web3d browsers that
> > never supported vrml/classic will find they need a slight re-arrangement in
> > their parsing algorithm when transcribing it to support JSON.
> > In theory I should try some JSON before commenting.
> >
> > >
> > > Thanks for your effort.
> > >
> > > My comments on the code example:
> > >
> > > -------------------
> > > Group": [
> > > {
> > > "@bboxCenter": "0 0 0",
> > > "@bboxSize": "-1 -1 -1",
> > > "@containerField": "children"
> > > , "Viewpoint": {
> > > "@DEF": "ViewUpClose",
> > > "@centerOfRotation": "0 -1 0",
> > > "@description": "Hello world!",
> > > --------------------
> > >
> > > A) Why writing default values? They are skipped in every other encoding?
> > > B) Why is there always @ in front of every field name?
> > > C) Why not using the javascript native types for numbers and booleans?
> > > D) Why an extra "@containerField"?
> > >
> > > My encoding suggestion:
> > >
> > > Group": [
> > > {
> > > "bboxCenter": [0 0 0],
> > > "bboxSize": [-1 -1 -1],
> > > , "children" : [
> > > "Viewpoint": {
> > > "DEF": "ViewUpClose",
> > > "centerOfRotation": [-0 -1 0],
> > > "description": "Hello world!",
> > > }
> > >
> > > Faster to parse (using native types) more compact and more explicit in
> > regards to the hierarchy connections.
> > >
> > > Best regards
> > > Johannes
> > >
> > >> Initial construction of X3D to JSON stylesheet is working. Examples attached.
> > >>
> > >> Working:
> > >> - elements, attributes, comments
> > >> - Square and squiggly brackets, commas
> > >> - escaping quotation marks
> > >>
> > >> TODO
> > >> - handling special characters
> > >> - elimination of default X3D attribute values
> > >> - CDATA text (for example, Script content)
> > >> - round-trip testing using a JSON-to-XML converter
> > >> - embedded support in X3D-Edit
> > >>
> > >> What X3D JSON specification will need to specify:
> > >>
> > >> - @attributeName
> > >> - "#comment"
> > >> - "#CDATA'
> > >>
> > >> Not possible:
> > >> - differentiate typing of string versus number values
> > >> - embedded JSON comments
> > >>
> > >> Example invocation from build.xml:
> > >> <target name="test.X3dToJson.xslt" depends="test.mkdir"
> > >> description="Test X3dToJson.xslt stylesheet using default Ant xslt
> > >> task"> <xslt style="X3dToJson.xslt"
> > >> in="${examples.dir}/HelloWorld.x3d" out="test/HelloWorld.json"/>
> > >> <echo message="converted test/HelloWorld.json"/> <xslt
> > >> style="X3dToJson.xslt" in="${examples.dir}/HelloWorld.x3d"
> > >> out="test/HelloWorld.scene.json"> <param name="sceneGraphOnly"
> > >> expression="true"/> </xslt> <echo message="converted
> > >> test/HelloWorld.scene.json"/> </target>
> > >>
> > >> p.s. once a web3d.org website problem is sorted out, these assets
> > >> will reappear at http://www.web3d.org/stylesheets
> > >>
> > >> Source updates remain are currently accessible via sourceforge at
> > >> http://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesh
> > >> eets/
> > >> http://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesh
> > >> eets/test
> > >>
> > >> 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
> > >> <HelloWorld.scene.json><HelloWorld.json><X3dToJson.xslt>-------------
> > >> -----------------------------------------------------------------
> > >> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> > >> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS
> > >> Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download
> > >> White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with
> > >> EventLog Analyzer
> > >> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg
> > >> .clktrk_______________________________________________
> > >> x3dom-developers mailing list
> > >> x3dom-developers at lists.sourceforge.net
> > >> https://lists.sourceforge.net/lists/listinfo/x3dom-developers
> > >
> > > ---
> > > Dr. Johannes Behr
> > > Head of Department: Visual Computing System Technologies
> > > Fraunhofer-Institut für Graphische Datenverarbeitung IGD
> > > Fraunhoferstr. 5 | 64283 Darmstadt | Germany Tel +49 6151 155-510 |
> > > Fax +49 6151 155-196 johannes.behr at igd.fraunhofer.de |
> > > www.igd.fraunhofer.de
> > >
> > >
> > > _______________________________________________
> > > X3D-Public mailing list
> > > X3D-Public at web3d.org
> > > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >
> > _______________________________________________
> > X3D-Public mailing list
> > X3D-Public at web3d.org
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
> _______________________________________________
> X3D-Public mailing list
> X3D-Public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
> x3dom-developers mailing list
> x3dom-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x3dom-developers
More information about the X3D-Public
mailing list