Re: Should instance element be optional?

Micah,

Thank you. Now I understand. The problem was I didn't go back to section 2.3
at the time of my question, merely because it is in the tutorial part. Perhaps
this default mechanism should also get a place in the formal part of the
document. The mechanism itself indeed makes sense. It will probably even be
used often in simple "structureless" forms.

Regards,

Werner.

Micah Dubinko wrote:

> Hi Werner,
> 
> The December WD did a poor job explaining this. The next one should be
> better. It goes something like this:
> 
> * Instance data (as in XSLT) always has a "root node" which is _not_ an
> element node, but rather performs the same function as the Document node in
> DOM (i.e. doesn't correspond to any particular part of a serialized
> document)
> * Top level elements are children of this root node.
> * There is always "instance data", even when there is no element
> <xforms:instance>
> * During initialization, the XForms processor creates the instance data
> --quite easy when <xforms:instance> is provided--merely a copy-children
> operation, otherwise:
>   - each binding expression is treated as a simple name (slashes cause an
> error)
>   - one element node with a matching name is created per form control
> 
> For this simple UI:
> 
> <xforms:input ref="a">...
> <xforms:input ref="b">...
> <xforms:input ref="c">...
> 
> You get:
> 
>     /
>     |
>  |--+--|
>  a  b  c
> 
> A tree with a root node, and element node children "a", "b", and "c".
> Entered form data would live in additional text nodes underneath the
> elements. Attempting to serialize this to XML (with @@@ representing entered
> data) would yield:
> 
> <a>@@@</a>
> <b>@@@</b>
> <c>@@@</c>
> 
> Which is why the binding expressions ref="a", ref="b", and ref="c" work. But
> it's _not_ well-formed XML, which needs to be singly-rooted. To get around
> this, at submit the XML serializer inserts a wrapper element as needed
> called <instanceData>, in no namespace, so that the submitted data on the
> wire would look like:
> 
> <instanceData>
>   <a>@@@</a>
>   <b>@@@</b>
>   <c>@@@</c>
> </instanceData>
> 
> Which looks much like the example at the bottom of 2.3 in the December
> draft.
> 
> Whew. This XML stuff gives me a headache. ;-)
> Thanks, and please continue to provide your excellent feedback.
> 
> .micah
> 
> 
> 
> -----Original Message-----
> From: Werner Donné [mailto:werner.donne@re.be]
> Sent: Tuesday, January 15, 2002 6:03 AM
> To: www-forms@w3.org
> Subject: Re: Should instance element be optional?
> 
> 
> Indeed, but I wonder what the rules mentioned in that section will be.
> Something will have
> to be generated for the instance data, otherwise the form controls are bound
> to nothing.
> 
> Regards,
> 
> Werner.
> 


-- 
Werner Donné  --  Re BVBA
Engelbeekstraat 8
B-3300 Tienen
tel: (+32) 486 425803	e-mail: werner.donne@re.be

Received on Wednesday, 16 January 2002 05:00:54 UTC