Bruno Dumon wrote:
I see no reason to not ask this question on the mailing list? Anyway,
see below.
Point taken, I was so focused that you have the answer that I wrote directly to you.
Anyway, thanks Bruno and here the answer for all ;-)
On Tue, 2004-06-01 at 13:38, Reinhard P�tz wrote:
Hi Bruno,
Recently I was asked why CForms use a widget-tree to store the form data.
why why why... why do we live?
Everything can be done in different ways, using different approaches, and in the end you have to choose one, the one you think or feel would be best.
I answered that we need strongly-typed data. The person asking me replied that we could have reached the same using a combination DOM tree and some kind of schema (XML Schema, RelaxNG).
I don't see where you would store the strongly typed data then? (or any of the state variables that are present in eg the Field class)
A DOM tree is a pure data model. CForm's widgets contain both data and behaviour.
The widget-tree API is easier: ie doing widget.getChild("otherwidget"): try to write the equivalent DOM-code for that.
I also don't see much use of nor the datatypes, nor the structural validation that XML Schema offers for the purpose of end-users filling in forms.
Sure there are all kinds of ways around it, ie annotating the schema with extra hints towards editing, making a custom DOM implementation, and so on. This would all be a very interesting exercise, but I'm paid to make working solutions, not to do research.
In short: it isn't as simple as just taking a readily-available DOM and XML Schema implementation together. And any solution you could come up with would probably not be that far of from binding a DOM to a CForms form, except that the distinction would be blurred. But I'd be happy to be proved wrong of course!
I searched the archives but can find the message, though I'm sure it was answered somewhere.
Can you give me a hint?
Many thanks in advance!
Best,
Reinhard
-- Reinhard
