The documentSchemas element in the XSF

A few customers have run into an unspecified error when attempting to add service pack features to an RTM form template when using the InfoPath SP1 Preview Release design mode. For anyone who has created a form template outside of InfoPath or added/changed the schemas for a form template by hand this might be an interesting read.

There is a section in the XSF called the documentSchemas section that is used to define all the namespaces and their corresponding XSD schema for the form template. Here is the documentSchemas element InfoPath creates for a form template that uses two namespaces “http://root” and “http://imported”, each with its own schema:

<xsf:documentSchemas>
<xsf:documentSchema rootSchema="yes" location="http://root root.xsd"></xsf:documentSchema>
<xsf:documentSchema location="http://imported imported.xsd"></xsf:documentSchema>
</xsf:documentSchemas>

Note that in this case, the root element of the form template comes from root.xsd and its documentSchema entry has an attribute “rootSchema” with a value of “yes”. The documentSchemas section should contain an entry for every namespace that is used in the main data source for the form template; herein lays the problem. The InfoPath team has seen a number of form templates where schemas were added outside of InfoPath but the documentSchemas section was not updated accordingly. Depending on whether you are the glass half empty or half full type of person, the RTM version of InfoPath didn’t mind this but the SP1 Preview Release does.

That should suffice to explain the issue; where does that leave you?

  • If you have never hand modified schemas or the XSF in RTM then don’t worry, you have no issues
  • If you have done this and are having issues upgrading your form template in the SP1 Preview Release then you should ensure your documentSchemas element is up to date with the schemas in your form template
  • If you have done this and are reading this post as an archived article then you may not see any issues since we are working around this issue in post preview release builds. However, there are potentially some features that will be lost since we are essentially reverting to RTM behavior for the data source (such features as seeing choice nodes in the data source pane and adding an entire schema to an open section of the data source may be disabled in this case.) You should make sure the documentSchemas section is correct before upgrading the form template.

With all that said there is some pretty good news – with the SP1 Preview Release you can now provide an updated schema to InfoPath and we will update the form template accordingly. This will be the topic of another blog entry soon!