XFA Specification
Chapter 11, Forms That Initiate Interactions with Servers
Invoking ADO APIs Through the Source Set DOM
342
It is necessary to employ some scripting to use this facility. The names of objects in the source set DOM for
the most part correspond closely to names of objects defined in the ADO API Reference
[ADO].
The Adobe
XML Form Object Model Reference
[FOM]
interface. However the objects in the source set DOM are not hard to use and a simple example suffices to
illustrate them.
In the example there is a customer database containing a table of contact information. Each row of the
contacts table contains first and last names for one contact, and possibly other columns but we are not
interested in them. The form displays one row from the table at a time, using one field for each of the first
and last names. The fields are editable. There are buttons to open and close the database, to move
forward or backward in the table, to update the current record after editing, and so on. Each button
operates on the database via a very simple (one-line) script which invokes a method of an object in the
source set DOM.
The Source Set Document
In the example the source set document is as follows:
<sourceSet xmlns="http://www.xfa.org/schema/xfa-source-set/1.0/">
<source name="FFADOData1" db="customer">
<connect>
<connectString>DSN=NoPasswordTest</connectString>
<user/>
<password/>
</connect>
<command timeout="30">
<query>
<recordSet cursorType="static" cursorLocation="client"
lockType="optimistic" max="0" bofAction="moveFirst"
eofAction="moveLast"/>
<select>Contacts</select>
<map from="FirstName" bind="#bind0"/>
<map from="LastName" bind="#bind1"/>
</query>
</command>
<bind id="bind0" ref="$record.contact.FirstName"/>
<bind id="bind1" ref="$record.contact.LastName"/>
</source>
</sourceSet>
The elements that make up this source set document are discussed individually below. They are discussed
in the order in which they occur in this example.
See “Source Set Specification” on page 755.
The sourceSet element
This is the outer element of the source set document, or source set packet inside an XDP. It must be in the
namespace
http://www.xfa.org/schema/xfa-source-set/1.0/
as must the other elements
discussed here.
The source element
The source set DOM contains any number of
source
objects, each of which represents an individual
connection to a data base or other ADO object. These can be connections to different data bases, or
different views of the same data base, or the same view of the same data base. The same piece of data in