XML Data Source Weirdness in SharePoint Designer 2010

Using the XML File Data source is SharePoint Designer 2010 is a very handy thing indeed. In my experience it can be a bit buggy to get it to work. Sometimes it just works and many times I find myself staring at the screen waiting..and waiting..and waiting.. and nothing. Somehow I figured out a weird way to get it to work and so far it's always worked for me, although I am at a loss to understand why but here it is.

 

Environment Out-Of-Box Team Site

Environment-Out-Of-Box-Team-Site.png

I'll start with an out of the box team site at the top level site of a new site collection. Out of the box other than the change I made to the Title, Description and some text on the front page.

 

 

Open SharePoint Designer

Open-SharePoint-Designer.png

I almost always use Site Actions> Edit in SharePoint Designer so I'm in the right site.

 

 

Click All Files

Click-All-Files.png

You can put the file in the site pages library if you like but I'll put mine here.

 

 

Add an XML file

Add-an-xml-file.png

Choose File>XML

 

 

Name the file

Name-The-File.png

I named mime Books.xml since the XML file I'm using is a list of books. After I name it I click the name to open the file for editing.

 

 

Paste in content

Paste-In-Content.png

Microsoft offers a great sample XML file called books at this URL: http://msdn.microsoft.com/en-us/library/ms762271(VS.85).aspx but I could have used any well formed XML document. I just went to Microsoft.com and searched for books.xml

 

 

Verify Well Formed XML

Verify-Well-Formed-xml.png

I click the edit tab in the ribbon and then click verify well formed XML which is a very handy tool to be included.

 

 

Check Message the click OK

Check-Message-Click-OK.png

As long as the file is all right as indicated by the message I'll click OK otherwise i would have had to work with the file a bit first.

 

 

Be sure to save

Be-Sure-To-Save.png

Save often in SharePoint Designer 2010.

 

 

Close Books File

Close-Books-File.png

I just right click the tab, Books.xml and choose close.

 

 

Click Data Sources in Navigation

Click-Data-Sources-In-Navigation.png

Now that I have my file I'll configure it as a data source. It might actually show up in the data sources list since it's an XML file but i want to configure security and give it a name.

 

 

Click XML File Connection icon in the ribbon

Click-XML-File-Connection-Icon-In-Ribbon.png

 

Click Browse button

Click-Browse-Button.png

 

Select Books.xml file

Select-Books-xml-File.png

 

Set Security

Set-Security.png

I'll be using Windows authentication so i choose the radio button as shown.

 

 

Click General Name Data Source

Click-General-Name-Data-Source.png

I'll name mine BooksXMLFile and be sure to choose that vs. the raw XML file when adding a Data View. When I'm done i click OK.

 

 

Click all Files

Click-All-Files_1.png

 

Add New ASPX page

Add-New-aspx-page.png

I choose File>ASPX page.

 

 

Name file and Edit File in Advanced Mode

Name-file-and-edit-in-advanced-mode.png

I name the file Books.aspx and then right click on it and choose Edit File in Advanced Mode.

 

 

Delete form tag

Delete-Form-Tag.png

A Short cut is to hit escape and then delete when your mouse is in a white area on the page, but delete the form tag for sure.

 

 

Attach Master Page

Attach-Master-Page.png

I select the Style Tab in the ribbon, and then click Attach and Choose the Default Master Page.

 

 

Add Custom Content PlaceHolder Main

Add-Custom-Content-PlaceHolder-Main.png

Once again i go back to the PlaceHolderMain and grab the glyph and choose Create Custom Content.

 

 

Place cursor in PlaceHolderMain then click Insert tab

Place-Cursor-In-PlaceHolderMain-Click-Insert-Tab.png

I be sure to place my cursor within the now editable PlaceHolderMain and click the Insert Tab on the Ribbon.

 

 

Click Data View then choose BooksXMLFile

Click-Data-View-Choose-BooksXMLFile.png

I choose DataView> BooksXMLFile (you might have to scroll down) , If it just goes in, it's cool, it does happen sometimes, but more often than not….nothing happens.

 

 

If nothing happens, click View TaskPanes Data Source Details

If-Nothing-Happens-Click-View-TaskPanes-Data-Source-Detai.png

By the way if your data went in you can stop here because the rest is only for if nothing happened. But if nothing happens after completing the steps above, in other words your XML data isn't showing, then click View in the ribbon and then click Data Source Details.

 

 

Insert Web Part Zone

Insert_Web_Part_Zone.png

Every once in a while that does the trick, but if it doesn't you can make sure your cursor is in the PlaceHolderMain and then choose the Insert Tab and click the Web Part Zone Icon in the Ribbon, this inserts a traditional web part zone into the PlaceHolderMain.

 

 

Insert Data Source

Insert-Data-Source.png

Once the Web Part Zone is inserted you can click the Data Source Icon in the ribbon and choose BooksXMLFile, you might have to scroll down.

 

 

Save

Save.png

Always remember to Save often when using SharePoint Designer.

 

 

Default to Masters Content

Default-To-Masters-Content.png

At this point even if something happens I default to Masters Content using the glyph for PlaceHolderMain I choose Default to Masters Content.

 

 

Create Custom Content

Create-Custom-Content.png

Then I try again. Using the glyph for PlaceHolderMain, select Create Custom Content.

 

 

Place cursor click Insert Tab Save Page

Place-Cursor-Click-Insert-Tab-Save-Page.png

Place the cursor inside of the PlaceHolderMain, Click the Insert Tab in the ribbon and click save.

 

 

Click Insert Tab DataView BooksXMLFile

Click-Insert-Tab-DataView-BooksXMLFile.png

Just like before.

 

 

The data should now be showing

The-Data-Should-Now-Be-Showing.png

Not sure why this works but it seems to work every time i try it. I'm not even sure how i figured out to try these steps. Sometimes it's just best to know it works.

 

 

Spike Xavier
SharePoint Instructor – Interface Technical Training
Phoenix, AZ

Posted in SharePoint | Posted in , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">