XForms uses XML Schema for defining the structure of the instance data. However, XML Schema may not always be implementable on all clients, for example, mobile clients requiring a small footprint. In recognition of this fact, XForms defines two conformance profiles for XForms implementations :
The only difference between these conformance profiles is the extent of XML Schema support that is needed. XForms Basic does not require XML Schema structures. In addition, it eliminates some of XML Schema's built-in types that rarely if ever occur in XForms applications.
The lack of XML Schema structures in XForms Basic means that an XForms Basic client does not have access to cardinality constraints expressed via attributes minOccurs and maxOccurs ; these are defined by XML Schema structures; See Section 2.5.3. The absence of these attributes is felt in XForms Basic when working with repeat structures; XForms Basic clients need to be able to ensure that a collection of nodes being operated on by repeat remains valid with respect to cardinality constraints such as
Such cardinality constraints can be expressed via model property constraint described in Section 5.6. Here, we illustrate the use of property constraint in expressing such cardinality constraints with an example in Figure 5.9.
Figure 5.9 Expressing cardinality constraints via property constraint .
< model xmlns ="http://www.w3.org/2002/xforms" xmlns:xsd ="http://www.w3.org/2001/XMLSchema" id ="cart" schema ="cs.xsd"> < instance id ="c1"> < line-item xmlns =""> < item >< product >...</ product ></ item > < quantity >1</ quantity >< cost /> </ line-item ></ instance > < bind nodeset ="/cart" constraint ="count(line-item) > 3"/> </ model >
The key thing to notice is that the cardinality constraint is expressed by applying model property constraint to the container ”in this case, the shopping cart. In this sense, cart can be thought of as an array of item elements, and property constraint defines the bounds on the dimensions of this array.