New Datasources for XUL Templating

XUL, the XML-based UI language used in Mozilla products, has supported templating for a while now. Unfortunately, the only datasources you could use to drive the templates were RDF-based datasources. This has been a hurdle for some, including me, to really dive into XUL templates.

Recently, Neil Deakin landed support for generic XML datasources, so I no longer have an excuse to not use XUL templates. Here’s an example:

RDF way


// Use a predefined RDF datasource


  

XML way


// Use an inline XML datasource or a URL-based XML datasource


  
  

 

  
 

The results are the same: A list of

2 Replies to “New Datasources for XUL Templating”

  1. Wonderful — but how about JSON? XML is still too heavy for large, remotely-based datasources … I’ve been writing a CMS based on XUL which dynamically creates editable listboxes based on data stored in MySQL on the server side and transmitted as JSON to the client side. It’d be great if the JSON could be used as a native datasource, rather than have proprietary code create the listitems as DOM elements in the browser.

    JSON is close to being a standard data format — similar enough to YAML and Python and Ruby hashes that it makes almost no odds. It’d be great to see something so pragmatic become a part of XUL, and it would steal a much-needed jump on XAML, AIR and the rest of the rich-client competitors.

    Don’t get me wrong — XML as a real datasource for XUL is a great leap forward. But let’s not get bogged down in the old Java/XML paradigm. Leap forward into the 21st Century!

    R

  2. Next week, I will have time to work on the Storage “driver” (bug 321172).

    @robert : the template system have been rewritten and now you can develop your own “datasource driver”. So you can create a JSON datasource driver for XUL templates 😉 (however, there is still a bug to do new datasource driver easily, bug 321170)

Comments are closed.