Info Path .XSN Inside: Part 1

In this series, I'll explain to you how to work programmatically with .xsn file in a very low-level manner. The main idea behind these articles is that on the web there are very few fragments of information regarding the subject. So let's start with the first part.
 
As we all know, InfoPath is an application for designing, distributing, filling, and submitting electronic forms containing structured data. But InfoPath is not only this simple, in fact, but you can also implement this form in every application developed by Microsoft! You can insert it into your Outlook mail, Access from, SharePoint from. You can add it everywhere, which was quite impressive. So this was the main reason to move from old .NET and Access forms to new InfoPath apps.
 
At first look (from the developer side) it's some strange .xsn format
 
Inform1.gif
 
For which there is very little information on the internet. But after some experimenting, it turns out that .xsn is a cab file with a changed extension. For those who don't know what a cab file is, I'll explain it. A cab file is a Windows native compressed file (something like a zip file) that contains more than one file. So when we rename the .xsn to .cab and try to open it, we get the following screen:
 
Inform2.gif
 
Which gives us all the needed information that we've been looking for. This archive contains several files:
  • EMEA_Countries - This file contains an Excel workbook-like XML schema that stores system information about Regional settings that the .xsn file inherits, author of the project, system schemas, and fonts.
  • EMEA_Countries.CSV - This CSV file contains informational data for the file which was explained above.
  • EMEA_Countries. - This file is used as a manifest file for the EMEA_Countries.
  • Manifets.xsf - This file stores all the schema for the operational .xsn file which stores all the schemas and fields that are used in .xsn file.
  • myschema.xsd - This file is used for initializing an internal schema which is used for the body of the .xsn file. In other words, this file stores the information about what type of fields are created and what type of links they have between each other.
  • sampledata.xml - Basic template that will be the result after submitting the xsn form with row data.
  • Template.xml - This is the template from which the xml result file is generated.
  • upgrade.xsl and view1.xsl - Are responsible to give the template file a way to set a typical design or to give an opportunity to the developers to create a more beautiful file.
So this was the basic information about the InfoPath forms and the elements from which the .xsn file consists.
 
In the next part, I'll give more information on how at the very low level we can check and fill a form from the code in the .xsn.