[x3d-public] New X3D JSON Loader that is namespace aware optionally.

John Carlson yottzumm at gmail.com
Sat Mar 19 11:08:43 PDT 2016


JSON path was the original URL (perhaps not including http://….) that the JSON was downloaded from, or a placeholder.  The contents, if any, are not used. The path is not extensively tested, and works best relative to web root (not starting with http or /).  If you look at index.html, you will see that I am loading JSON files starting with the current web root (http://localhost:3000/.  In X3DExamplesViewer, I am loading from the examples symbolic link on the web server.   There are examples in loaderJQuery.js that use the path to load URLs, particularly loadX3DJSON

I’m going to read your next email. brt

John

> On Mar 19, 2016, at 9:55 AM, Clement IGONET <clement at igonet.fr> wrote:
> 
> OK. Thanks.
> Anyway, I'm confused with the difference between json and json path.
> Are we talking about the same json?
> 
> Clément.
> 
> On Sat, Mar 12, 2016 at 8:55 PM, John Carlson <yottzumm at gmail.com> wrote:
>> The api is documented in GettingStarted.rtf. Path is the url of the JSON,
>> you can probably put in "flipper.json"  it's used when I'm using
>> X3DExamplesViewer.html, if the url to the JSON has /'s in it.  NS is used
>> when generating xml (pass an empty or full array into xml).   If you do use
>> xml, do an xml.join ("\n") on the results.  The load X3DJS() function
>> returns a DOM element which can be added to the document with
>> element.appendChild ().   I don't know if you can add it to an existing
>> element or not.  You may have to pass in the whole X3D JSON file and not a
>> subscene.  So,
>> 
>> element.appendChild (loadX3DJS (json, "foo.json", [])) should work.
>> 
>> John
>> 
>> On Mar 12, 2016 2:58 AM, "Clement IGONET" <clement at igonet.fr> wrote:
>>> 
>>> Hi John,
>>> 
>>>   I used an old version of your X3D JSON loader but after an update,
>>> I've seen the interface has changed for loadX3DJS function and I don't
>>> how to handle it.
>>> 
>>>> function loadX3DJS(json, path, xml, NS)
>>> 
>>>   I'm a bit confused by the lack of doc (README.md) and comments (in the
>>> code).
>>>   I don't know what are mandatory parameter and what is expected.
>>> 
>>>   My goal is to be able to give x3d json data as input and to have
>>> this data loaded in a x3d(om) scene.
>>>   I can imagine that "json" is for x3d json data.
>>>   I don't really understand what is the goal and the format for the
>>> "path".
>>>   I guess "xml" is an optionnal parameter...
>>>   I guess I don't need "NS" for the moment...
>>>   As I understand, we can get a return value to anchor in a
>>> component... Be I'm not sure of what to understand...
>>> 
>>>   Could you give me more explanation or/and a complete example. An
>>> all-in-one file would be very convenient for a demo.
>>> 
>>> Clément.
>>> 
>>> On Fri, Feb 26, 2016 at 8:14 AM, John Carlson <yottzumm at gmail.com> wrote:
>>>> I have been having problems generating XML for consumption by Cobweb.  I
>>>> finally discovered that I needed to set a namespace.  When I set a
>>>> namespace, then X3DOM no longer work as well.  So I made namespace optional.
>>>> 
>>>> New version is here:
>>>> 
>>>> http://coderextreme.net/X3DJSONLD/
>>>> 
>>>> https://github.com/coderextreme/X3DJSONLD/
>>>> 
>>>> Happy X3D JSONing!
>>>> 
>>>> John
>>>> _______________________________________________
>>>> x3d-public mailing list
>>>> x3d-public at web3d.org
>>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org




More information about the x3d-public mailing list