An InfoPath solution is saved into a single file with an .xsn extension. This template file is actually a set of compressed files stored as a CAB file that are combined together to provide the necessary semantic information for the InfoPath client to render a form. The separate files within the template are designed in a hub and spoke relationship, with the form definition file providing the single entry point. The actual form definition file uses an .xsf extension and is by default named manifest.xsf . This file consists of XML documents that use the namespace and associated schema of http://schemas.microsoft.com/office/infopath/2003/SolutionDefinition . Table 2.4 lists the types of files contained within the solution file and their extensions.
File Type | Extension | Description |
---|---|---|
Template Definition (Manifest) | .xsf | This is an InfoPath-generated XML file that contains all the information about the other files and components used within a form template. This file acts as the packing list or manifest for the solution. |
Schema | .xsd | The XML schema file that is used to determine the types, names , and constraints of a valid document. |
View | .xsl | The presentation logic files that are used to present, view, and transform the data contained in the XML document files. |
XML Sample File | .xml | An XML file that contains the default data for fields when a new file is created based on the document class described in the form template. |
Presentation | .htm, .gif, .xml | Files that are combined with the view files to create the custom user interface. This also includes the default XML sample file that is used to populate default values. |
Business Logic | .js, .vbs | The script files (either Jscript or VB Script) that contain the programming code. This code implements specific editing restrictions, data validation, event handlers, and data flow. |
XML Component Template | .xct | An XML file representation of the editing controls that are used in design mode when users are creating and filling out a form. |
Binary | .dll, .exe | Custom Component Object Model (COM) components that provide additional business logic. |
Packaging | .xsn | A compressed file format that packages all the form templates into one file with an .xsn extension. |
To run an InfoPath form, you first load the XML instance that it is associated with. The information in the form definition file, shown in Listing 2.2, allows InfoPath to display XML data and to define the associated user interface and interactivity. During the loading procedure, the XML data instance has an XML processing instruction (PI) that determines the type of application and points to the location of the InfoPath solution to use when loading the instance data.
<?xml version="1.0" encoding="utf-8"?> <?mso-infoPathSolution solutionVersion="1.0.0.3" productVersion="11.0.4920" PIVersion="0.9.0.0" href="file:///D:\Programming%20Microsoft%20InfoPath%20A%20Developers%20 Guide\Chapter%202\Samples\Contact%20Form\EmployeeContact.xsn" ?> <?mso-application progid="InfoPath.Document"?> <my:employeecontact xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myxsd/2003- 05-17t01:23:36" xml:lang="en-us">
The template definition file, shown in Listing 2.3, is the main entry point for all InfoPath solutions. This file contains the pointers and references that are needed to both run and manage solutions. This structured XML document contains a variety of elements that define the behavior and functionality of the InfoPath document.
Listing 2.3: The structured XML format of the template definition file.<xsf:xdocumentclass name=