Chapter 4, Exchanging Data Between an External Application
and a Basic XFA Form
XFA Specification
Basic Data Binding to Produce the XFA Form DOM
169
<template>
<subform name="application">
<subform name="sponsor">
<field name="lastname"> … </field> <!-- sponsor's last name -->
<field name="lastname">
<bind match="dataRef" ref="$data.application.lastname"/>
…
</field> <!-- applicant's last name -->
…
</subform>
…
</subform>
</template>
The result using this template fragment and the same data is shown in the following figure. This is the
desired result.
Template DOM
application
Form DOM
application
Data DOM
application
lastname
“Abbot”
sponsor
sponsor
sponsor
lastname
lastname
lastname
“Costello”
lastname
lastname
Scope-matching prevented using an explicit data reference
Content Type
In XFA, the template may supply a field with default data that is rich text or an image. However the type of
data bound into a field, as indicated by its
contentType
property, may differ from the type of the default
data. For example a field with a textual default may bind to an image. The data binding process makes no
attempt to match the content type.
Similarly, in an interactive context, the UI may constrain the user to enter data of a particular type.
However when the data is supplied from some other source it need not match the UI type. For example a
field with a numeric UI may bind to alphabetic data. This is considered normal and proper. The user is still
constrained to enter a date when editing the field.