The W3C Forms working group held its quarterly face to face meeting last week in New York at IBM's T. J. Watson research center in Hawthorne. The bulk of the agenda was devoted to addressing XForms 1.1 last call issues. We had an extremely productive session, but there are over 150 comments to address, so we have only made it a little more than half way through.
One issue that arose at the face to face (thanks to a last call comment from Erik Bruchez) was a disconnect between was XForms does with single node user interface bindings and the setvalue action versus what schema validation does and what the type model item property does. The schema definitions and the type MIP validate the entire content of an element node, but the text for UI bindings or setvalue actions say that when they reference an element, the binding is to the first text node child of the element.
There were a few reasons why this was done in the past. One concern was about the confusion of binding to the whole referenced element, which you couldn't really do because the element may have attributes. However, at the time, no one really thought about it in terms of binding to the element content. Instead, the larger concern was that people wanted to be able to edit mixed content, which meant resolving down to individual text nodes so that interspersed comments and processing instructions would not be lost. However, one can still bind to individual text nodes by referring to them directly rather than referring to their parent element. This would preserve any sibling comments or PIs. So there are solutions to the key issues of interpreting an element reference as a reference to its full content, and here are some additional cases that caused problems:
- If the element node is empty, the DOM may have a child text node, but XForms is based on the XPath data model, so there would be no text node to bind to, leading to the perverse conclusion that the UI control should be non-relevant (invisible) because it is bound to no node of instance data.
- If an element node contains '1' followed by a comment followed by 'A', then the UI control would show '1', but datatype validation against xsd:integer would fail because the entire content '1A' is checked by schema.
- If the UI control causes the first text node to become empty, technically it is supposed to cease existence in the data model, which should rebind the control to the second text node. So in the case above, if you erase the 1, an A appears!
All of the above are preposterous. Implementations aren't doing the first and third, and there is incompatibility on the second. I was therefore very pleased with today's Forms WG telecon, where the group resolved to change the wording of UI bindings and of the setvalue action so that when they reference an element with the single node binding (@ref or @bind), then they manipulate the entire content of the referenced element, not just its first text node.