Hi Peter,
This is great news !
I suggest you create an entry in the new Slign Wiki with your findings
and attach your script(s) (I should be ready with this sometime around
the middle of this week. I will inform the list). From that we may
further explore the options, e.g. creating a new module in Sling
supporting this functionality.
Regards
Felix
Am Samstag, den 09.02.2008, 13:10 +0100 schrieb Peter Svensson:
> With a lot of help from Bertrand, I've been able to create en esp
> script which gives back fairly standard json. I don't know much about
> which properties and function s are actually present on each node, so
> I grabbed the ones I saw, just to get a tree up and running.
>
> heres a snippet which I used in conjunction with the 15 minutes Sling
> example;
>
> <%
> function dumpResource(r, level)
> {
> var rv = "\n{";
> rv += 'name: "'+r+'",\n';
> rv += 'type: "'+r.type+'",\n';
> var p = r.properties;
> var iterator = r.children;
> if (iterator.hasNext())
> {
> rv += "children: \n[\n";
> while(iterator.hasNext())
> {
> rv += dumpResource(iterator.next(), level + 1)
> + ", \n";
> }
> rv = rv.substring(0, rv.length-3)+ "]\n";
> }
> else
> {
> rv = rv.substring(0, rv.length-2);
> }
> rv += "}\n";
> return rv;
> }
>
> out.print(dumpResource(resource, 1));
> %>
>
> And then I created a couple of extra nodes under the example
> node /content/mynode and I actually got up a small tree and two
> childre.
>
> Now I have to clean up my code which is full of failed experiments,
> and then we can go forward.
>
> Also, I'm not sure where this script should reside, and where bunkai
> itself should be put..
> I also need to find a good license to put bunkai under.
> The source code editor is not mine, for instance.
>
> Cheers,
> PS
>
>
>