Create a data connection to an XML file in InfoPath 2010

Applies to: InfoPath 2010

Learn how to create a data connection to retrieve data from an XML file that is stored as a resource file in an InfoPath 2010 browser-enabled form template that is to run in InfoPath Forms Services in SharePoint 2010 and filled out through a browser.

ADVERTISEMENTS

InfoPath 2010 supports connecting to several types of external data sources to retrieve data. Examples include Web Services, SharePoint List, Databases, and XML files.

This article lists the steps to create a data connection to an XML file that is stored as a InfoPath resource file of a browser-enabled form template.

Once such a data connection is created, the XML file then becomes a secondary data source of the InfoPath form template.

To create a data connection to an XML file to retrieve data:

  1. In InfoPath 2010, create a new Blank Form template.
  2. On the Data tab under the Get External Data group, click From Other Sources, and then click From XML File.

    Get external data from an XML file in InfoPath 2010
    Figure 1. Get external data from an XML file in InfoPath 2010.

  3. On the Data Connection Wizard, click Browse to browse to and select an XML file, and then click Next.
  4. Connections to XML files on the local computer, or in a network folder, are not allowed in Web browser forms, so you are forced to include the XML file as a resource file in the form template. This means that the XML file will become part of the .XSN file that makes up the InfoPath form template. Click Next.
  5. Change the name of the data connection if you wish, leave the Automatically retrieve data when form is opened check box selected, and then click Finish.

You can double-check that the XML file was indeed added as a resource file in the InfoPath form template by clicking on Resource Files under the Form Data group on the Data tab on the Ribbon.

Now you can use the data connection to the XML file as the data source for for example a drop-down list box.

 


Related InfoPath Articles:

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services