Use a live XML data source

Cc295239.bf9c77b1-ba7a-4f3b-8380-d05728d208d1(en-us,Expression.40).png

An XML data source can be a local XML file or an XML file on a remote web server.

For an example of using a remote XML file, see Try it: Create an RSS news reader.

To add an XML data source

  1. In the Data panel, click Create data source Cc295239.601d2ab6-5e4b-49ab-bb3c-064456dc8184(en-us,Expression.40).png, and then click Define New XML Data Source.

    The Define New XML Data Source dialog box appears.

    Tip

    You can also add an XML data source by dragging a source from Windows Explorer or from the Projects panel onto the Data panel.

  2. Do one of the following:

    • To use a local XML file, click the Browse button next to the URL for XML Data text box, browse to the XML file that you want to use, and then click Open.

      Note

      If you are using a local XML file, we recommend that you add the XML file to your project so that the file will be built into the application. This makes sure that your application will work when you deploy it. Alternatively, you can deploy the application and the XML file together, as long as the path of the XML file remains the same.

    • To use a live XML file on the web, type the URL in the URL for XML Data text box. For example, type http://rss.msnbc.msn.com/id/13282720/device/rss/rss.xml for the RSS feed of Wonderful World news on MSNBC.

  3. Next to Data source name, type a descriptive name.

  4. Under Create data source in, select one of the following:

    • To make the data available to all documents in your application, select Project.

    • To make the data available only to the current document, select This document.

  5. Click OK.

    The Data section of the Project panel is now populated with the data that is parsed from the XML file. The data type for each node in the data source is listed in parentheses.

    You can now bind objects in your project to the XML data by dragging items of data from the Data panel to the artboard or to an existing object.

    For more information, see Bind an object to data.

See also

Tasks

View a list of available data sources
Delete a data source
Switching from sample data to live data

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.