Pages

2011-12-09

XML binding to Snippetory templates

Once, a while ago I discussed a rapid prototyping solution. It consists of three parts:
  1. A way to mount pages of fragments
  2. A way to bind XML data to these pages including a way to edit the data using forms defined in these pages
  3. A framework for fine grained substitution of this primitive persistence layer by full featured persistence, validation and arbitrary logic.
This time I'd like to detail the XML binding.
Snippetory templates are passive. This means they do not contain any business nor any data binding logic. And this in turn means arbitrary logic can be used to bind the data. Additionally, Snippetory provides a reflective interface. This allows generic logic to analyze the structure of Snippetory templates to be able to handle the data binding at least in simple cases. On the other hand XML provides pretty much the same features. So binding the XML data could be done like this:

This is pretty generic code. And, when implementing such complex logic, it's really nice to have recursion at hand. As such Snippetory offers completely new ways in templating.

No comments:

Post a Comment