You are reading O'Reilly XForms Essentials by Micah Dubinko. (What is this?) - Buy XForms Essentials Online

Complex Types

In XML Schema, a complex type is a datatype definition that can include element structure and attributes, which makes possible a number of additional (and, yes, complex) features including substitution groups, redefinition, and complex derivation. XForms includes the whole of XML Schema, though an easier-to-process profile that will leave out the complicated parts is still under development.

In many cases, the XML that will be processed by XForms already has a pre-existing XML Schema. In such cases it makes good sense to re-use the Schema by referencing it from the XForms Model. By doing so, additional datatype information will be made available to XForms.

If a Schema doesn't already exist, however, it's generally better to define only the minimum needed datatypes and leave it at that. The main reason for this recommendation is that many devices—those that adhere to a simpler XForms profile—will ignore all these more complicated features, and that any form that relies on them will produce different answers, depending on whether an XForms Full or XForms Basic device is accessing them.

For example, a Schema might define a coarse complexType that gets redefined into one with stricter validations. These stricter validations won't be seen by XForms Basic, and thus the unsuspecting person filling out the form might enter wrong values and have no idea they're even making a mistake.