RE: Please consider bind hierarchies for the next draft

This is a good proposal. We will consider it. -m

-----Original Message-----
From: Tomayko, Ryan [mailto:Ryan_Tomayko@stercomm.com]
Sent: Thursday, December 13, 2001 11:38 AM
To: 'www-forms@w3.org'
Subject: Please consider bind hierarchies for the next draft


It would be nice if the bind elements could be used in a hierarchy. For
example, consider the following instance document and XForms constraints per
XForms specification:

<xf:instance>
  <po xmlns="">
    <orderInformation>
      ...
    </orderInformation>
    <lineItems>
       <lineItem>
         <sku/>
         <unitPrice/>
         <quantity/>
         <uom/>
         <lineTotal/>
       </lineItem>
    </lineItems>
  </po>
</xf:instance>

<xf:bind ref="po/lineItems/lineItem" maxOccurs="25" minOccurs="1"/>

<xf:bind ref="po/lineItems/lineItem/unitPrice" 
         relevant="not(../sku = '')"/>

<xf:bind ref="po/lineItems/lineItem/lineTotal"
         calculate="../unitPrice * ../quantity"/>

Now, consider the slightly revised bind elements below:

<xf:bind ref="po/lineItems/lineItem" maxOccurs="25" minOccurs="1">
   <xf:bind ref="unitPrice" relevant="not(../sku = '')"/>
   <xf:bind ref="lineTotal" calculate="../unitPrice * ../quantity"/>
</xf:bind>

The result is a noticeable decrease in the length of ref expressions and,
IMO, more organized markup. This solves a couple of problems our
implementation is currently exposing:

1. XForms developers complain of having to type extremely long paths over
and over. For instance, writing constraints for 5 or ten nodes that are
children of the following element can be quite tedious:
"xcbl:AdvanceShipmentNotice/xcbl:ASNHeader/xcbl:ASNOrderNumber/xcbl:ListOfMe
ssageId/xcbl:MessageID" 
(example taken from an xCBL Advance Ship Notice.)

This also results in rather ugly markup.

2. Obvious performance enhancements. Again, having to evaluate the long path
listed above 5 times as apposed to one.


My suggestion is to modify the XForms schema to allow the <xforms:bind>
element to be a child of itself. When a bind element is being processed by
the XForms Processor, the context nodeset for XPath expressions is set to
the nodeset returned by evaluating the ref expression of that bind. The
nodeset returned is iterated over and each child bind's constraints are
evaluated in the context of the individual nodes of that nodeset (much in
the same way a repeat works for UI controls).

This would greatly enhance the readability of bind elements and would also
serve as a fair performance enhancement. I am looking at a couple of early
XForms document attempts for rather large business documents and the binding
constraints get really messy when created in the current fashion.

Thanks,
- Ryan




Ryan Tomayko <rtomayko@stercomm.com>
Sterling Commerce

Received on Thursday, 13 December 2001 15:34:24 UTC