InfoPath 2010 browser-enabled forms cannot be opened - "The following document is not a valid InfoPath form"

Environment:

SharePoint 2010, InfoPath 2010 browser-enabled forms

 

Issue description:

We have alot of InfoPath forms in SharePoint 2010. These forms were migrated from InfoPath 2003 client to InfoPath 2010 browser-enabled. Occasionally a few InfoPath forms cannot be opened in browser with the following error:

There has been an error while loading the form.

The following document is not a valid InfoPath form: {path of form}

 

Cause:

After doing some research and comparision, I noticed that we have a rich text field in the form that users use to copy and past html content from the internet. The pasted content includes the following string that caused this issue:

<?XML:NAMESPACE PREFIX = "[default]" http:="http:" xmlns:http="urn:http" ?>

 

Resolution:

  • Download the form to local machine. Open the form in notepad. Find the above string and delete.
  • From SharePoint library, find the affected item.
  • Checkout the item (if checkout is required)
  • Upload a file to the library, point the path to the local path of the newly saved xml file.
  • Save
  • Open the form from SharePoint, it should open in browser without any issue.