Join Gini von Courter for an in-depth discussion in this video Reading data from an XML file, part of SharePoint Designer 2013: Creating Data-Driven Sites.
- The first external data source that I'm going to show you how to connect to is a very simple data source. It's an XML or extensible mark-up language file. A data file that's basically stored and tagged. You would get this type of a file, because someone has some information that they want to give you on a periodic basis, and whatever system they're using can out put XML. So, they'll say well I'm going to give this to you, would you rather have it as a spreadsheet or as XML, and if you want to use it in this way, XML is the right answer.
I've got a sample file that's available from Microsoft, from the developers network. It looks like this. It's a books file. Lots of people have been using this. It's been kicking around for a while. All you need to do is go to this site, following URL that's on your screen. It'll take you right here, and then you simply copy this. So, now I have this sitting on the clipboard. The next thing I'm going to do is, I'm going to save this. I need to put it in something, and you don't want to use Microsoft Word or Microsoft Excel for this, you want to use the Windows Notepad.
So simply open up the notepad, and paste this information in, and then save this file, and do not use the .txt file extension. What you want to do is you want to save this file as a .XML. So, that it will be an XML file. So save this somewhere that you would like to have it. I've done that already, and I've also uploaded this file already to my share documents folder on my Sandbox site. It's right here. Now, if I just want to open this so I can see it, if I just viewed this file it would look just like it did in the sample.
It would normally display in a browser, and even though it's human readable, it's not very friendly. I'd like to be able to work with it, and give it a better presentation. First, I need to connect with it with SharePoint Designer. So here it is sitting in SharePoint. Now, let's swing over to SharePoint Designer. Here I am in the Sandbox, and I'm going to go to data sources, and here are my choices for the types of data sources that I can add. I'm going to choose XML file connection. It asks me where my file is, and when I'm browsing, it's expecting it to be in SharePoint.
I'm going to go to my share documents library, choose books XML, click open. Give it a second to fire-up, I hit need to provide it with a name. I can call it books. I could also call it books and authors or book titles. Whatever I'd like to provide, and I can also provide a description here. Now, if I had imported this into for example Excel, and then hit published it in SharePoint, I would get the pages. I would get a view page for this, and I would get other pages.
All I'm doing is connecting this to my site. So, it's not going to automatically generate any pages for me. The description, therefore, is a attached directly to this data source not to any page that it would appear on. There's a place for description and a place for some key words. Also, there's a place to indicate that I need to provide some login information. I don't need to provide any login information, I'm already logged into this site, other people who use this will already be logged in to this site. This is a generic data source properties dialogue box that provides for other circumstances as well.
I'm all set. I'm going to click okay. Notice that its name is not book.xml, but book titles the name that I gave it for use as a data source here in SharePoint. Just to be clear, even though many of the items that are listed here as data sources are list and libraries, they're not the same. For list and libraries, our native data sources, we already have pages that will display their information. That is not the case for our XML files.
You'll see later how to display our external data source on a page.
- Managing data sources
- Displaying external data with RSS, XML, and Data View Web Parts
- Using Business Connectivity Services
- Creating data-driven pages
- Enhancing data presentation
- Filtering data
- Displaying associated lists