Connect a form to an external XML document
When you add a data connection that receives data from an external XML document or data source to your Microsoft Office InfoPath 2003 form, Office InfoPath 2003 creates a secondary data source for your form. This data source lets you populate list boxes with values from the XML document, and bind controls to the fields and groups associated with the XML document. In general, you can work with the secondary data source in many of the same ways that you work with your form's primary data source.
Note The values associated with a secondary data source cannot be saved when a user fills out a form, although they can be submitted to a Web service using a submit data connection. In addition, you cannot edit the properties or structure of the fields and groups associated with a secondary data source, nor can you specify default values or custom, noncode-based data validation for those fields.
- In design mode, click Data Connections on the Tools menu.
- In the Data Connections dialog box, click Add.
- In the Data Connection Wizard, click Receive data, and then click Next.
- On the next page of the wizard, click XML document, and then click Next.
- On the next page of the wizard, type the location of the XML document, and then click Next.
- On the next page of the wizard, type a name for the data connection.
- If you want to automatically receive data whenever the form is opened by a user, select the Automatically retrieve data when form is opened check box, and then click Finish.
Note If the form does not automatically receive data, you may want to insert a button that retrieves the data when clicked.
- If a dialog box that asks if you want to add the XML document to your form opens, do one of the following:
- To include the XML document as a resource file in your form, which will always let users have access to the file, click Yes.
- To prevent the XML document from being added as a resource file, which will require that users have access to both the form and the location of the file, click No.
Note The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more