I got stuck pretty quickly, however, on how JavaScript interacts with
the query processor. Specifically, I want the ability to change my
XML, save it to disk, and show the changes in the templates.
As a first start, I thought I'd check just how to edit my XML on disk
and reload. After around 3 hours of spelunking through interfaces and
the new docs and Venkman, I haven't really found anything that shows
how I would approach this. Certainly the old RDF-based docs about
adding datasources aren't applicable.
Inline XML works, where I grab the data node and manipulate it with
DOM calls, then doing mytree.builder.rebuild() will redraw it. But
for external data, no amount of chanting and trial-and-error has
gotten me there.
If it matters, I'm doing this in a XULRunner app from a nightly build.
There isn't one. But there should be. Please file a bug, as it is a
minor fix for something that should definitely be available.
As a very hacky workaround though for chrome only, you could do:
var doc =
node.builder.getResultForId('row2').getBindingObjectFor('?').ownerDocument
> There isn't one. But there should be. Please file a bug, as it is a
> minor fix for something that should definitely be available.
added bug 410812
Thanks for the fast response (and thanks Mark for filing the bug).
The hacky workaround will serve my needs for quite a while, thanks.
In general, though, could you explain how one should approach
incremental updates and observers using the new approach? In the old
days, you could just make an assertion into an RDF datasource, and the
various pixels on the UI that needed updating, were updated.
Is it correct to say that, with nsIXULTemplateQueryProcessor, I'm in
charge of knowing when the data changes, and the calling
builder.rebuild() on the whole enchilada?
Hmmm....getResultForId worked and returned a nsIXULTemplateResult.
getBindingObjectFor('?') returned null. I wondered if perhaps I
should pass in "?name" to grab one of my variables. That worked for
getBindingFor but returned null for getBindingObjectFor.
--Paul