You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Hochsteger Andreas /INFO-MA <An...@oeamtc.at> on 2004/03/05 09:26:29 UTC

[CForms] [RT] Simplified XML-binding

Hi,

I don't know, if you had the same experience, but it always feels nasty to
me when I do simple XML bindings, where xml element names and field ids are
always called the same.
Wouldn't it be good to make some attributes optional in the binding
definition?

Here's a partial example from the file form2_bind_xml.xml:
<wb:repeater
	id="contacts"
	parent-path="contacts"
	row-path="contact"
	unique-row-id="id"
	unique-path="@id">
	<wb:on-bind>
		<wb:value id="firstname" path="firstname"/>
		<wb:value id="lastname" path="lastname"/>
		<wb:value id="phone" path="phone/@nr"/>
		<wb:value id="email" path="email"/>
	</wb:on-bind>
</wb:repeater>

That's what I'd like to write:
<wb:repeater
	id="contacts"
	row-path="contact"
	unique-row-id="id"
	unique-path="@id">
	<wb:on-bind>
		<wb:value id="firstname"/>
		<wb:value id="lastname"/>
		<wb:value id="phone" path="phone/@nr"/>
		<wb:value id="email"/>
	</wb:on-bind>
</wb:repeater>

So what I mean is, that if the @path is missing on wb:value it defaults to
the same as @id and if @parent-path is missing on wb:repeater it defaults to
@id too.
Perhaps there are some more simplifications possible.

What do others think?

Bye,

Andreas