9 Using XForms with Other Document Types


Contents

This chapter is normative.

XForms have been designed for use within other XML vocabularies, in particular XHTML. This chapter discusses some of the high-level features of XForms that allow it to be used with other document types.

9.1 The XForms Namespace

The XForms namespace has the URI: http://www.w3.org/2001/02/xforms. Future revisions are expected to use a different identifier. This document uses the convention of an xform: prefix to represent elements and attributes that are part of the XForms Namespace.

XForms Processors must use the XML namespaces mechanism [XML Names] to recognize elements and attributes from this namespace.

9.2 The <xform> Element

The <xform> element is used as a container for other XForms elements, and can serve as the root element of a standalone document or be embedded in other document types such as XHTML. A single containing document may contain any number of <xform> elements.

XML Representation<xform>
<xform
  xmlns = namespace-identifier
  id = xsd:ID
>
  <!-- Content: (submit | bind)*, model, instance -->
</xform>

Attribute Definitions:

xmlns = namespace-identifier
Optional standard XML attribute for identifying an XML namespace. It is frequently useful to include this standard attribute at this point.
id = xsd:ID
Optional unique identifier used to refer to this particular <xform> element.

For example:

<xform xmlns="http://www.w3.org/2001/02/xforms" id="Person">
   <model href="Schema-Questionnaire.xform" />
   <instance href="URL-to-retrieve-defaults" /> 
   ...
</xform>

9.2.1 The <model> Element

The <model> element is used to define the XForms Model. The content of the XForms Model may be defined inline or obtained from a external URI.

Editor's Note: The Working Group is actively investigating the potential of using XLink simple links within XForms.

XML Representation<model>
<model
  id = xsd:ID
  href = xsd:uriReference
>
  <!-- Content: (xsd:schema | simple) -->
</model>

Attribute Definitions:

id = xsd:ID
Optional unique identifier.
href = xsd:uriReference
Optional link to an externally defined XForms Model.

The content of the <model> element is restricted to either XML Schema content, or XForms simple syntax. The content of <simple> is defined in the XForms Model chapter.

Editor's Note: We still need to define behavior if both an inline XForms Model and an external XForms Model are used together.

9.2.2 The <instance> Element

The <instance> element is used to define initial instance data. The instance data may be defined inline or obtained from a external URI.

XML Representation<instance>
<instance
  id = xsd:ID
  href = xsd:uriReference
>
  <!-- Content: (##other) -->
</instance>

Attribute Definitions:

id = xsd:ID
Optional unique identifier.
href = xsd:uriReference
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.

[Editor's Feedback Request 9.2.2.schemalocation: Should a schemaLocation attribute, linking the instance data with a schema definition, be present here?]

9.2.3 SubmitInfo

The <submitInfo> element provides information on how and where to submit the instance data.

XML Representation<submit>
<submitInfo
  id = xsd:ID
  target = xsd:uriReference
  method = xsd:string
>
  <!-- Content: (##empty) -->
</submitInfo>

Attribute Definitions:

id = xsd:ID
Optional unique identifier.
href = xsd:uriReference
Required destination for submitted instance data.
method = xsd:string
Optional indicator to provide details on the submit protocol. With HTTP, the default is "POST".

9.2.4 Bind

The <bind> element represents a connection between the different parts of XForms.

XML Representation<bind>
<bind
  id = xsd:ID
  ref = XForms binding expression
>
  <!-- Content: (##empty) -->
</bind>

Attribute Definitions:

id = xsd:ID
Required unique identifier.
ref = XForms binding expression
A link to an externally defined XForms Model.

Additional details are found in the Binding chapter.