Don,
Sounds interesting.
Can you put the generated JS (JSON) code into an LZX script block,
and compile that into your laszlo app?
i.e., does the data really have to be dynamically loaded into the
client app?
If it does, you may want to take a look at the data compiler sources
-- they do something pretty similar to what you're looking for, but
it'd be great to remove this from the system at some point as it's
not really needed for most cases now. (The data compiler is used by
proxied data requests and by XML-RPC, SOAP, and Java-RPC requests).
Or alternately try representing it as XML and gzipping it before
deciding that it's too big/inefficient. It might just be OK.
- D.
On Dec 29, 2005, at 3:05 PM, Don Hopkins wrote:
I have some JavaScript data structures (i.e. JSON) that I’d like a
Laszlo program to be able to efficiently download.
Essentially I’d like to do the same kind of thing as what happens
when you fetch a SWF encoded XML file, except that it’s JSON
instead of XML.
Is there a simple way to wrap a JSON object up so the Laszlo
compiler will make it into a SWF file that you can dynamically
download into a running Laszlo app, and execute to get the raw
JavaScript data (instead of cooked JavaScript data representing XML)?
The reason I don’t want to simply represent the data as XML and
then load it into Laszlo the normal way (having the server compile
the XML into SWF), is that there’s a whole lot of data and it would
fluff up a lot of it were represented as XML represented as
JavaScript objects, so I just want to send the raw simple
JavaScript objects instead. Plus I want this to be compatible with
web browser JavaScript interpreters that can read and process JSON
much more efficiently than XML.
The application: I’m working on a Relax NG engine in JavaScript,
for validation and data binding, and I’d like to be able to run the
core JavaScript Relax NG engine code in Laszlo as well as the web
browser.
So that the code running in the browser can be as simple and
efficient as possible, the server will compile the Relax NG schema
into a normalized optimized JSON representation.
I’m using a James Clark’s “jing” for compiling the Relax NG schema,
and writing out its internal optimized data structures.
Relax NG is wicked cool! I love the way the Laszlo compiler uses a
Relax NG schema with annotations to define the syntax and some
semantics of the programming language.
I’d be interested to hear more about what the Laszlo compiler
developers (and other people) think of Relax NG, how they’re using
it, and what tools are used to process it!
Here are some notes I wrote about Relax NG:
Relax NG Compact Syntax: no to operator precedence, yes to
annotations!
http://www.donhopkins.com/drupal/node/115
Relax NG: Design-by-Inspired-Individuals vs. Design-by-Committee
http://www.donhopkins.com/drupal/node/116
Maximizing Composability and Relax NG Trivia
http://www.donhopkins.com/drupal/node/117
-Don
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev