The presentation of this document has been augmented to identify changes from a previous version. Three kinds of changes are highlighted: new, added text, changed text, and deleted text.
Please refer to the errata for this document, which may include normative corrections.
This document is also available in these non-normative formats: diff-marked HTML .
The English version of this specification is the only normative version. Non-normative translations may also be available.
Copyright © 2009 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This module defines support for external model documents which may be imported for reuse in a containing model.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.
This document was produced by the W3C Forms Working Group as part of the Forms Activity within the W3C Interaction Domain. The working group has supplied a test suite (zip file) and an implementation report demonstrating at least one implementation for each test of a feature and at least two interoperable implementations for each test of a required feature.
Please send comments about this document to www-forms-editor@w3.org. (with public archive). Please send discussion email to www-forms@w3.org (with public archive).
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
1 Document Structure
1.1 The XForms Core Module
1.1.1 The model Element
1.1.2 The bind Element
1.1.3 The import Element
XForms is an application of XML [ref-xml-1.0] and has been designed for use within other XML vocabularies—in particular within a future version of XHTML [ref-xhtml-1.0]. XForms always requires such a host language. This chapter discusses the structure of XForms that allow XForms to be used with other document types.
The XForms Core Module defines the major structural elements of XForms, intended for inclusion in a containing document. The elements and attributes included in this module are:
Element | Attributes | Minimal Content Model |
---|---|---|
model | Common, functions (QNameList), schema (list of xsd:anyURI), version (xforms:versionList) , src (xsd:anyURI), resource (xsd:anyURI) | (instance|xs:schema| submission|bind|Action|import)* |
instance | Common, src (xsd:anyURI), resource (xsd:anyURI) | (ANY) |
submission |
| (resource | method | header)*, Action* |
bind | Common, Model Item Properties, nodeset (model-binding-expression) | (bind)* |
import | src (xsd:anyURI), resource (xsd:anyURI) | EMPTY |
Elements defined in the XForms Actions module, when that module is included, are also allowed in the content model of model
and submission
, as shown above.
Within the containing document, these structural elements are typically not rendered.
The XForms Processor must ignore any foreign-namespaced attributes that are unrecognized.
Note that the presence of foreign namespaced elements is subject to the definition of the containing or compound document profile.
This element represents a form definition and is used as a container for elements that define the XForms Model.
No restriction is placed on how many model
elements may exist within a containing document.
Common Attributes: Common
Special Attributes:
Author-optional space-separated list of XPath extension functions (represented by QNames) required by this XForms Model. Guidance on the use of this attribute is at ???.
Author-optional list of xsd:anyURI
links to XML Schema documents outside this model
element. The XForms Processor must process all Schemas listed in this attribute.
Within each XForms Model, there is a limit of one Schema per namespace declaration, including inline and linked Schemas.
The schema definitions for a namespace are determined to be applicable to instance nodes based on an instance schema validation episode initialized to lax processing. When an element lacks a schema declaration, the XML Schema specification defines the recursive checking of children and attributes as optional. For this specification, this recursive checking is required. Schema processing for a node with matching schema declarations is governed by its content processing definition, which is strict by default.
Note:
The schema
list may include URI fragments referring to elements located outside the current model elsewhere in the
containing document; e.g. "#myschema"
. xs:schema
elements located inside the current model need not be listed.
Author-optional attribute with a default value of empty string and legal values defined by the datatype xforms:versionList. Examples are "1.0"
and "1.0 1.1"
. If one or more versions are indicated by this attribute on the default model
, then an XForms Processor must support at least one of the listed language versions of XForms. Otherwise, the XForms Processor must terminate processing after dispatching the event xforms-version-exception to the default model
. If the XForms Processor supports more than one language version indicated by the version setting on the default model
or if the version setting on the default model
is empty string (whether specified or by default), then the XForms Processor may execute the XForms content using any language conformance level available to it. If any non-default model
has a version setting that is incompatible with the language version selected by the XForms Processor, then the XForms Processor must terminate processing after dispatching the event xforms-version-exception to the default model
.
Author-optional link to externally defined model definition. If the link traversal fails, it is treated as an exception (???).
Author-optional link to externally defined model definition. If the link is traversed and the traversal fails, it is treated as an exception (???).
If the src
attribute is given, then it takes precedence over inline content and the resource
attribute, and the model content is obtained from the link. If the src
attribute is omitted, then the model content is obtained from inline content if it is given or the resource
attribute otherwise. If both the resource
attribute and inline content are provided, the inline content takes precedence.
Editorial note: Meaning of resource on model | |
Do we intend to save only running instance data when doing save/restore for remotely access models? Other model content,
such as bind , submission etc are static and so do not need save/restore function. A different policy for
processing resource on model and import seems to be required. |
If the model content is given by a link (from src
or resource
), then the model is formed by consuming the linked resource as follows. The root of the linked resource must be
an XForms model
element. Model attributes are transferred to the referencing model
element and
processed as though originally authored there. Note that src
and resource
attributes are allowed on external
model definitions provided they do not result in cyclical references.
The content model for externally referenced models is identical to that of local content. Foreign namespaced elements and attributes are not supported by the core structure of XForms but may be defined by extension processors.
Child content of external model
elements is imported into the referencing model and processed as though originally authored there.
If the link cannot be traversed, then processing halts after dispatching an xforms-link-exception with a resource-uri
of the link that failed.
Examples:
model
, with the XForms namespace defaulted:<model id="Person" schema="MySchema.xsd"> <instance resource="http://example.com/cgi-bin/get-instance" /> ... </model>
<model> <message level="modal" ev:event="xforms-version-exception"> <output value="event('errorinformation')"/> </message> ... </model> ... <model id="m2" version="1.1"> ... </model>
Since the version
attribute is not specified on the model
, the XForms Processor may choose any language conformance level, which may be incompatible with the version setting of the second model
. Therefore, the message action occurs during initialization of the second model
due to its version incompatibility with the default model
.
<model version="1.0 1.1"> ... </model> ... <model id="m2"> ... </model>
Since the version
attribute is not specified on the second model
, it is compatible with any choice made based on the version setting on the default model.
<model id="Person" src="http://www.example.com/person_model.xml"/>
where person_model.xml contains:
<model schema="MySchema.xsd"> <instance> ... </instance> </model>
import
element:<model id="Person"> <import src="http://www.example.com/person_model.xml"> ...other inline model content or import statements </model>
where person_model.xml is as shown above.
Editorial note: Treatment of IDs in imported model content | |
WG minutes discuss use of name vs id for bind elements but what should be the treatment
for instance as shown above? |
Element bind
selects a node-set from the instance data with either
a model binding expression in the nodeset
attribute or the
default of the in-scope evaluation context node. Other attributes on element bind
encode
model item properties to be applied to each node in the
node-set. When bind
has an attribute of type xsd:ID
, the bind
then associates
that identifier with the selected node-set.
Common Attributes: Common, Model Item Properties (author-optional)
Special Attributes:
An author-optional attribute containing a model binding expression that selects the set of nodes on which this bind
operates.
If the attribute is omitted, the default is the in-scope evaluation context node.
See ??? for details on model item properties.
See ??? for details on how the evaluation context is determined for each attribute of the bind
element.
The import
element allows model content to be reused from external resources and included in a parent referencing model along with
other imports and inline model content. Multiple import
s may be used to build up models from a collection of reusable model definitions.
Note that imported model content forms a single coherent model from a behaviorial perspective with extenal model elements
behaving as though direct child elements of the referencing model. In other words, no submodel structure is created by the import
mechanism.
Implementations may choose to merge imported content into a single model infoset or maintain separate infosets provided the behavior of the resulting overall model is as described above.
import
references are resolved during the model-construct phase of initialization.
Special Attributes:
Author-optional link to externally defined model definition. If the link traversal fails, it is treated as an exception (???).
Author-optional link to externally defined model definition. If the link is traversed and the traversal fails, it is treated as an exception (???).
If the src
attribute is given, then it takes precedence over inline content and the resource
attribute, and the model content is obtained from the link.
If the src
attribute is omitted, then resource
is required and the model content is obtained from inline content if it is given or the resource
attribute otherwise.
If both the resource
attribute and inline content are provided, the inline content takes precedence.
The only valid inline content for import
is the instance
element. The use case for inline import
content is
to allow for save and restore of long-running forms where instance content is originally obtained following resource
links
but then to be restored from locally saved inline data. Processors should construct instance
content inline within import
elements when saving such forms for later continuation.
Editorial note: Saving recursively imported instance data | |
When imported model content contains nested imports, where should processors save instance data for later restore? Options could include at the root model level regardless of import nesting, in separate documents (ugly), or within the root importing element (not clear this is better than just at the root document level). |
When importing model content by a link (from src
or resource
), then the model is extended by consuming the linked resource as follows. The root of the linked resource must be
an XForms model
element. Imported attributes from external model
elements are transferred to the referencing model
element and
processed as though originally authored there. Note that src
and resource
attributes are allowed on external
model definitions provided they do not result in cyclical references.
As in the use of src
and resource
on model
elements, the content model for externally referenced models is identical to that of local content. Foreign namespaced elements and attributes are not supported
by the core structure of XForms but may be defined by extension processors.
Child content of external model
elements is imported into the referencing model and processed as though originally authored there.
The containing import
element does not imply any scoping or other behaviorial difference with respect to model content
obtained from external resources.
Editorial note: Position of saved imported instance data | |
When saving model instance data for subsequent reloading according to the Note that the override of saved instance content by reloading imported content with |
If the link cannot be traversed, then processing halts after dispatching an xforms-link-exception with a resource-uri
of the link that failed.