Gary Lapointe is a genius (and has good music taste too)

I recently encountered an nasty, nasty error that threatened to cause me a lot of grief.

I exported a site to a new site collection and initially things looked okay. However, I soon started to encounter strange errors such as:

clip_image002

… and for the benefit of the search engines:

Data at the root level is invalid. Line 1, position 1.   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at Microsoft.SharePoint.Publishing.PublishingWeb.GetAvailablePageLayouts()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.GetAvailableLayouts()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.LoadLayoutValues()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.LoadValues()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.LoadValues()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.OnLoad(EventArgs e)
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Anyway ,my initial search came across an MSDN forum post that I used to solve my problem. I didn’t do it all with the code on the site, and I manually hacked the database directly to boot. But despite this, I was very impressed with the author’s (Gary) troubleshooting skills. This guy is good!

As it turns out, the STSADM -export/import command doesn’t work too well when you export a sub-site and import it to the top level site in a site collection. Bad things happen!

Anyhow, I was preparing a detailed blog post on this issue and how I resolved it, when I came across Gary’s blog where he has already gone into the detail required and as an added bonus, added his fix to his brilliant STSADM custom extensions.

I downloaded it, tried it, and it worked flawlessly the first time.

So, head on over to Gary’s blog and check out his excellent work.

Thanks, mate – you saved me a lot of pain!

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.