Re: Please consider bind hierarchies for the next draft

I strongly second this proposal.  It would be a great addition for all the 
reasons cited.

Jim

At 02:37 PM 12/13/2001 -0500, Tomayko, Ryan wrote:
>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:ListOfMessageId/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 <<mailto:rtomayko@stercomm.com>rtomayko@stercomm.com>
>Sterling Commerce
>
>

--
jim@jbrix.org

Visit www.jbrix.org for:
   + SpeedJAVA jEdit Code Completion Plugin
   + Xybrix XML Application Framework
   + other great Open Source Software

Received on Thursday, 13 December 2001 16:40:24 UTC