From:
<fre...@aj...> - 2006-02-14 12:08:07
|
A bit Late, but an answer about XForms implementation of Orbeon. Very nice answer, indeed. > Disclaimer: I am not a huge fan of XML Schema!=20 > XML Schema is not > that bad and does allow you to do some useful stuff, even if it is > overly rigid and frustrating (compared, say, to Relax NG). Some may need this precision. > Now, you can be fairly declarative if you use types, for example: >=20 > <xs:simpleType name=3D"street-name-2"> > <xs:restriction base=3D"xs:string"> > <xs:pattern value=3D"([A-Z]|[a-z]|\-|\.|\/|\s){0,22}"/> > </xs:restriction> > </xs:simpleType> such datatypes could also useful to write for Relax-NG <http://books.xmlschemata.org/relaxng/relax-CHP-8-SECT-1.html> > And you can also use those types from within XForms without thinking > about structure, with for example: >=20 > <xforms:bind nodeset=3D"my-street" type=3D"dmv:street-name-2"/> You are right, it's clean. > Also, since XForms allows you to modify the structure of a document > (xforms:insert, xforms:delete, xforms:copy), you may want to check its > structure, and in this case using XML Schema's ability to control > structures is handy. Granted, in many cases you don't really need it. [validation of relations] > > <customer id=3D"customer123">Name, FirstName</customer > > "check this customer before save this contract" > OPS has an extension XPath function that allows you to call any XML > pipeline. In XForms, you have other mechanisms to perform validation > in addition to XML Schema: you have simple types, and constraints. You > could say: >=20 > <xforms:bind nodeset=3D"customer" > constraint=3D"string(xxforms:call-xpl(...)) =3D 'true'"/> >=20 > Where the call to XPL passes the <customer> element, then runs the > pipeline, which can do whatever you want, including calling up eXist > to check the existence of the user. > > > Xquery is needed here ? >=20 > Yes if checking the existence of the particular user in eXist requires > XQuery... I guess that more complex Xquery could be embed in an OPS pipeline, not a completely portable solution, but can save lots of bad code. This validation writing seems also clear to maintain and debug. > > Is your implementation adapted to update for example, a leave in a b= ig > > doc ? > > You can do that by using XUpdate and XQuery with eXist, right? You > should try to keep your XForms instances small for reasons of memory > usage and performance (it takes time to create a DOM). Certainly, you > can extract a subset of an eXist document with XQuery, then work on > that with XForms, and finally update that leave with XUpdate in eXist > again. I don't see any obstacle do doing that. If it's a leave in a doc, you guess it needs reference validation, but your answer upper provide a possible solution. > > I figure that the XML instance is stored as a DOM during client > > interaction ? And you save it as a resource in Exist ? >=20 > We have a 2-state state keeping: one as string, where the entire > XForms engine state is just an gzipped, encrypted string. This is in > fact a key to a cache, where we keep a "live" version of the state. In > that live version, that's correct, XForms instances are kept as DOM, > in fact as dom4j instances. Note that you can have as many XForms > instances as you want with XForms. So I guess it could be very expensive for the server ? What are common requirements in memory or CPU for OPS ? This is a very convincing demonstration for Exist users. --=20 Fr=E9d=E9ric Glorieux (AJLSM, http://ajlsm.com) |