Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XML datasources on trunk and how to do updates

7 views
Skip to first unread message

plonepaul

unread,
Jan 3, 2008, 9:10:45 PM1/3/08
to
As someone that spent a lot of time manually manipulating RDF
datasources, I'm excited to try out the new XML datasources with XUL
templates.

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.

Neil Deakin

unread,
Jan 4, 2008, 9:53:25 AM1/4/08
to
plonepaul wrote:
> 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.

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

Mark Finkle

unread,
Jan 4, 2008, 12:22:02 PM1/4/08
to
On Jan 4, 9:53 am, Neil Deakin <enndea...@sympatico.ca> wrote:

> 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

plonepaul

unread,
Jan 4, 2008, 2:45:37 PM1/4/08
to
On Jan 4, 9:53 am, Neil Deakin <enndea...@sympatico.ca> wrote:

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?

plonepaul

unread,
Jan 4, 2008, 4:20:01 PM1/4/08
to
On Jan 4, 9:53 am, Neil Deakin <enndea...@sympatico.ca> wrote:

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

0 new messages