The instance element

Release 2.0 - ...

This author-optional element contains or references initial instance data.

It is allowed to have multiple instances within an model element, however it is then required to specify an id attribute.

Example

XML CopyCode image Copy Code
<xf:model>
   <xf:instance xmlns="">
      <root>
         <data />
      </root>
   </xf:instance>
   <xf:instance id="second" xmlns:a="http://example.org/">
      <a:mydata>
         <a:data />
      </a:mydata
   </xf:instance>
</xf:model>

Attributes

Name Required / optional Description
src optional Link to externally defined initial instance data. If the link traversal fails, it is treated as an exception
resource optional Link to externally defined initial instance data. If the link is traversed and the traversal fails, it is treated as an exception.
Common Attributes optional Any attribute from the Common Attributes collection (e.g. id).

If the src attribute is given, then it takes precedence over inline content and the resource attribute, and the XML data for the instance is obtained from the link.

If the src attribute is omitted, then the data for the instance 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.

Content

Within anĀ instance element, the following child elements are allowed:

Element Name Required / optional Description
xs:any optional Any element from any namespace, but it must have a single root element.

Specification

Link to the XForms specification: the instance element.