xforms:modelAdded by IBM on August 8, 2013 | Version 1 (Original)
|Contains the instance data, binds, and submission information for the form. Can also contain schema information that applies to the instance data.
The xs:schema is a schema that conforms to the W3C XML Schema specification. If present, the schemas are constantly enforced within the XForms model.
Table 1. xforms:model parameters
<xforms:model id="name schema="schema URIs functions="functions>
|name||string||Optional. An arbitrary name that you may assign to each model and data instance. The first model/instance is default, and does not require an ID. All subsequent models and instances do.
All names assigned to id attributes must be globally unique within the form.
|schema URIs||string||Optional. A space-separated list of URIs that point to external XML schema files. These schemas are constantly enforced within the XForms model.
This supports HTTP, HTTPS, and file URIs.
For example: schema="http://myServer/.../mySchema.xfd"
File URI references depend on the location of the schema file:
Important: When referencing external schema files, you cannot combine reference methods. For example, if your space-delimited list of schemas contains a reference using HTTP, you cannot include another using xsf.
- If the schema files are in the <IBM Forms product>\schemas directory, use the xsf: prefix. For example: schema="xsf:name.xsd xsf:address.xsd" The Viewer's default schemas directory is <Viewer Install Dir>\schemas. Webform Server's default schemas directory is <WebSphere Application Server Install Dir>\AppServer1\java\bin\schemas.
- If the schema files are in the same directory as the form, reference them directly. For example: schema="mySchema.xsd mySecondSchema.xsd" This method can only be used in the Viewer. It does not work in Webform Server.
|functions||string||Optional. A space-separated list of extension functions used by XPaths in XForms attributes. Functions defined by XForms 1.1 do not need to be listed. This attribute allows you to list extension functions, if any, that are used in the form. For example:
Available data types
XML Schema defines a group of data types that can be used with the <xforms:model> tag. This includes the following commonly used types:
For more information about the available XForms data types, refer to the XForms Datatypes section of the W3C XForms specification, and for more information about the available XML Schema data types, refer to the W3C XML Schema specification.
- xforms:boolean or xsd:boolean
- xforms:date or xsd:date
- xforms:double or xsd:double
- xforms:integer or xsd:integer
The following example shows a small XForms data model that contains the name, age, and birth date of a person. The model includes binds that set the age to be an integer value and set the birth date to be a date value, as well as an submission that submits the entire instance.
<xforms:bind nodeset="age" type="xsd:integer"/>
<xforms:bind nodeset="birthdate" type="xsd:date"/>
<xforms:submission id="submitTest" method="post"
- Each data model can have any number of xforms:submissions. This is useful if you need to submit different data at given times, or if you need to submit the same data to different servers.
- The <xforms:model> portion of the xformsmodels option can trigger XForms actions using the xforms-model-construct, xforms-model-construct-done, xforms-model-destruct, and xforms-ready events. For more information, refer to XForms event handlers.
- If an element in the XForms data model is both empty and invalid, then any item on the form that is bound to that element is set to be mandatory.