Table of Contents | Prev | Next | Bottom |
Quick Table of Contents |
---|
4 Document Structure 4.1 The XForms Namespace 4.2 Horizontally Applicable Markup 4.3 XForms Head Elements 4.3.1 model 4.3.2 instance 4.3.3 schema 4.3.4 submitInfo 4.3.5 bind 4.3.6 privacy 4.3.7 action 4.3.8 extension 4.4 XForms and XLink 4.4.1 XLink Conformance and Examples |
The XForms specification is an application of XML [XML 1.0], and has been designed for use within other XML vocabularies, in particular XHTML [XHTML 1.0]. This chapter discusses the structure and high-level features of XForms that allow this specification to be used with other document types.
The XForms namespace has the URI: http://www.w3.org/2001/12/xforms
. Any future Working Drafts are expected to
use a different identifier, though a final identifier will
be allocated before XForms becomes a W3C Recommendation.
XForms Processors must use the XML namespaces mechanism [XML Names] to recognize elements and attributes from this namespace.
For cases when a particular element needs to be referred to
from another context, every element in the XForms namespace has declared an
attribute id
of type xsd:ID
in the Schema for XForms.
Foreign-namespaced attributes are allowed on any XForms element. The XForms Processor must ignore any foreign-namespaced elements or attributes that are unrecognized.
Except where specifically allowed by the Schema for XForms, foreign-namespaced elements are not allowed as content of elements in the XForms namespace.
Element model
is used as a container for other
XForms elements, embedded in the head
section of other document types such as XHTML. A single
containing document may
contain any number of model
elements.
model
>
<model id = xsd:ID > <!-- Content: instance?, schema?, (privacy|submitInfo|bind|action|extension)* --> </model>
id = xsd:ID - Optional unique identifier used to refer to this particular
model
element.
For example:
<model xmlns="http://www.w3.org/2001/12/xforms" id="Person"> <instance xlink:href="http://example.com/cgi-bin/get-instance" /> <schema xlink:href="Schema-Questionnaire.xsd" /> ... </model>
Element instance
is used to define initial instance data. The
instance data may be defined inline or obtained from a external URI.
instance
>
<instance xlink:href = xsd:anyURI > <!-- Content: (##other) --> </instance>
xlink:href = xsd:anyURI - Optional link to externally defined instance data
The content of the instance
element is arbitrary XML in any
namespace other than the XForms namespace. Authors must ensure that proper
namespace declarations are used for content within the instance
element.
Element schema
is used to define the
schema portion of the XForms Model. The
schema information may be defined inline or
obtained from an external URI.
schema
>
<schema xlink:href = xsd:anyURI > <!-- Content: ##other (though typically <xsd:schema>) --> </schema>
xlink:href = xsd:anyURI - Optional link to an externally defined XForms Model.
Element submitInfo
provides information on how, where and
what to submit .
submitInfo
>
<submitInfo (single node binding attributes) action = xsd:anyURI mediaTypeExtension = "none" | qname-but-not-ncname : "none" method = "post" | "get" | qname-but-not-ncname : "post" version = xsd:NMTOKEN indent = xsd:boolean encoding = xsd:string mediaType = xsd:string omitXMLDeclaration = xsd:boolean standalone = xsd:boolean CDATASectionElements = list of xsd:QName replace = "all" | "instance" | "none" | qname-but-not-ncname : "all" > <!-- Content: (##empty) --> </submitInfo>
single node binding attributes - optional selector enabling submission of a portion of the instance data
action - Required destination for submitted instance data.
mediaTypeExtension - Optional information, additional to the mediaType, describing the serialization format.
method - Optional indicator as to the protocol to be used to deliver the serialized instance data.
version - corresponds to theversion
attribute ofxsl:output
indent - corresponds to theindent
attribute ofxsl:output
encoding - corresponds to theencoding
attribute ofxsl:output
mediaType - corresponds to themedia-type
attribute ofxsl:output
omitXMLDeclaration - corresponds to theomit-xml-declaration
attribute ofxsl:output
standalone - corresponds to thestandalone
attribute ofxsl:output
CDATASectionElements - corresponds to thecdata-section-elements
attribute ofxsl:output
replace - specifier for how the information returned after submit should be applied.
Note:
Many of these attributes correspond to XSLT attributes [XSLT].
Note that the XSLT attributes doctype-system
and doctype-public
are not
supported in XForms processing.
Note:
Note also that
attribute mediaTypeExtension
is useful in cases where a media type alone is not sufficiently
precise. For instance, a SOAP envelope would not be adequately described simply by "text/xml", additional
information would be required.
Element bind
is defined at 6 Constraints.
Element privacy
is used to associate a P3P
[P3P 1.0] policy reference with a particular form.
privacy
>
<privacy xlink:href = xsd:anyURI > <!-- Content: (##empty) --> </privacy>
xlink:href = xsd:anyURI - Optional link to an externally defined P3P policyref file (not an actual policy).
Defined at 9.16 action.
Defined at 8.12.4.5 extension.
XForms use XLink [XLink] features for linking, or defining an explicit relationship between resources (or portions of resources), which may be either local or remote.
To that end, the XForms schema references
the XLink namespace with
sensible defaults.Other than xlink:href
attributes, form authors in most cases will not be required to explicitly write
XLink-specific elements or attributes.
All XLinks in XForms are simple links. For further details, see 4.4.1 XLink Conformance and Examples.
An XForms processor is not required to implement full
XLink—correct behavior of the xlink:href
attribute (as defined
in this chapter) is sufficient. For example, an XForms Processor must accept
and correctly process the schema in both of the following:
<xforms:model> <xforms:schema xlink:href="URI-to-remote-schema.xsd" /> </xforms:model>
<xforms:model> <xforms:schema> <xsd:schema ...> <!-- Content: ... --> </xsd:schema> </xforms:schema> </xforms:model>
This second example is unusual in that the xforms:schema
element defaults an attribute xlink:type="simple"
but lacks an xlink:href
attribute to make the link
meaningful. In this situation, the XForms Processor should switch from simple
mode to none
mode for the element lacking attribute xlink:href
. For
compatibility with XLink, the second example should be explicitly authored as
follows:
xlink:type
<xforms:model> <xforms:schema xlink:type="none"> <xsd:schema...> <!-- Content: ... --> </xsd:schema> </xforms:schema> </xforms:model>
Manual override of the xlink:type
attribute.
If both inline content and external reference is provided, a processor must use the external reference and ignore the inline content.
Table of Contents | Top |