Add an XML file as a data source

Your enterprise is storing more and more data in XML files. To make this data more accessible on your site, you want to use these XML files as data sources. With Microsoft Office SharePoint Designer 2007, you can easily add a connection to an XML file to the Data Source Library as a data source. After you connect to the XML file, you can create a view of data in the XML file by creating a Data View. To learn more about Data Views, see the article Create a Data View.

You can add an XML file as a data source to your site in any of three different ways. You can:

  • Create an XML file in Office SharePoint Designer 2007 and save it as part of your Web site.

  • Import an XML file from a file or folder on your computer or network.

  • Connect to an XML file that resides on an external server.

When you create or import a new XML file, a corresponding connection automatically appears in the Data Source Library. By default, every XML file in a site has a corresponding data source connection in the Data Source Library.

What do you want to do?

Create an XML file

Import an XML file located on your computer or network

Connect to an XML file located on an external server

Create an XML file

When you create an XML file in Office SharePoint Designer 2007 and save it as part of your Web site, a corresponding data source connection automatically appears in the Data Source Library.

  1. On the File menu, click New.

  2. In the New dialog box, on the Page tab, click General, and then click XML.

  3. Click OK.

    A new XML file with an XML DOCTYPE declaration (<?xml version="1.0" encoding="utf-8">) opens in your Web site.

  4. In Office SharePoint Designer 2007, position the insertion point after the XML DOCTYPE declaration, and then press ENTER to begin your XML file. After you create your XML file, make sure that the </xml> closing tag is included.

  5. On the File menu, click Save As.

  6. In the File name box, type a name for your XML file, and then click Save.

Note: 

  • When you work with an XML file as a data source, the XML file must contain only well-formed XML. Invalid markup may cause errors.

  • In addition, either the XML file must contain and conform to a schema, or it must contain data from which a schema can be inferred.

Top of Page

Import an XML file located on your computer or network

When you import an XML file into a site, a corresponding connection automatically appears in the Data Source Library.

  1. On the Task Panes menu, click Data Source Library.

  2. In the Data Source Library task pane, under XML Files, click Add an XML file.

    If the XML Files heading is collapsed, click the plus sign (+) to expand it.

  3. In the Data Source Properties dialog box, in the Location box on the Source tab, type the path to the XML file that you want, or click Browse to locate and select it.

    Type the URL for the XML file that you want, or click Browse to locate it

  4. When you are prompted to import the file, click OK. Click OK again.

Note: 

  • When you work with an XML file as a data source, the XML file must contain only well-formed XML. Invalid markup may cause errors.

  • In addition, either the XML file must contain and conform to a schema, or it must contain data from which a schema can be inferred.

Top of Page

Connect to an XML file located on an external server

When you connect to an XML file located on an external server (unlike when you import an XML file on your own computer or network), you do not import the file to your site. Instead, you link to it directly by using the URL of the external XML file.

  1. On the Task Panes menu, click Data Source Library.

  2. In the Data Source Library task pane, under XML Files, click Add an XML file.

    If the XML Files heading is collapsed, click the plus sign (+) to expand it.

  3. In the Data Source Properties dialog box, in the Location box on the Source tab, type the URL for the XML file that you want, or click Browse to locate and select it.

  4. Click OK.

    If the XML file resides in a site that requires a user name and password, you are prompted to provide these credentials.

  5. The XML file may also require logon credentials beyond those for the current Microsoft SharePoint site. You might need a user name and password to change the properties or to access the data, for example. If you know that you need additional credentials, click Login, and then click one of the following options:

    • Don't attempt to authenticate     This option either attempts an anonymous connection or supplies the current team member's credentials. Select this option if the XML file is not password-protected or if you want to require team members to use their user names and passwords to access any protected files.

    • Save this user name and password in the data connection     This option stores the provided user name and password so that anyone can access the file. Use this option if you want to bypass any existing password protection by typing the user name and password in the corresponding boxes.

    • Use Windows authentication     This option uses the current team member's user name and password. This option works only when Windows SharePoint Services 3.0 and the XML file are located on the same server.

    • Use Single Sign-On authentication (requires Microsoft Office SharePoint Server 2007)     This option can be used when your site is part of a portal site created by using Office SharePoint Server 2007 and when the administrator has enabled and configured Single Sign-On authentication. If you want to use Single Sign-On authentication, select this option, and then click Settings. In the Single Sign-On Settings dialog box, do the following:

      • In the Application Name box, type the application name for your database.

      • In the Application field to use as the user name box, type the name of the field in which your user name is stored.

      • In the Application field to use as the password box, type the name of the field in which your password is stored.

        If you do not have the necessary information, contact your server administrator.

Note: 

  • When you work with an XML file as a data source, the XML file must contain only well-formed XML. Invalid markup may cause errors.

  • In addition, either the XML file must contain and conform to a schema, or it must contain data from which a schema can be inferred.

Top of Page

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×