Complex types

XML schema element declarations can have simple or complex types. Attribute declarations can have simple types. In general, elements with simple types and attributes are mapped to fields in Designer. Elements with complex types contain other elements and attributes, or attributes, and are generally mapped to subforms.

Complex types are used to define all other elements. Complex types can define element content, simple content, mixed content, and empty content.

Any complex type element may or may not declare attributes.

How a subform is generated from element content in a data source

An element that has only element content and optionally, attributes, will generate a subform when dragged into the form design.

This subform will contain objects for each attribute declared on the element and objects or subforms for each child element.

Simple content

Simple content is where an element is declared to contain simple content (text data) and may also declare attributes. In the case where the element declares no attributes, the mapping is the same as that for simple elements.

When attributes are declared, the mapping for the elements is to a subform that is named by using the element name. This subform will contain a field bound to the element and additional fields for each attribute. The name of the field bound to the element will be the name of the element with the string "_data" appended to it. An example of this is an element (for example, <phone>) that has numeric content and an attribute named type:

<phone type="work">5554567</phone>

This will generate a subform named phone containing objects named type and phone_data. The type object is bound to$data...phone.type, the phone_data field is bound to $data...phone.

Mixed content

Mixed content exists when an element is declared to contain a mixture of element children and text content.

Empty content

Complex types with empty content will be treated like simple content, where the object that is created, and bound to the element, has no content allowed.

Occurrence

XML Schema occurrence attributes (minOccurs and maxOccurs) for element declarations, which generate subforms, will be mapped to the repetition properties for the subform.

Content models

Where the content model for the children of an element is anything other than a sequence, the mappings will attempt to model choice and all groups by using subformSets.

// Ethnio survey code removed