- "There is an error in XML document (1, 2)" And the the Inner Exception is
- <myFields xmlns='http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-01-16T10:47:10'> was not expected.
Then I suggest that you first check the following:
- The root element name of your InfoPath form (by default called "myfields") MUST match the class name of your xsd.exe-generated mapping file.
Otherwise the XmlSerializer will be looking for a root "myfields" (the default name) element in your C# class and it won't be able to map it to the equivalent element in your InfoPath Xml.
In other words, the xsd.exe generated wrapper class name must match the root element name of your InfoPath form.
For reference, I had this issue and it was simply because I renamed the class name of my xsd.exe-generated file (but I didn't rename my root Infopath element) and so the Serializer couldn't map the new class name to the old root element name in my InfoPath form.
2003 infopath office schemas.microsoft.com 2009-06-26T9:44:10:myFields myXSD>
2003 infopath office schemas.microsoft.com myXSD 2008-01-16T10:47:10?:myfields>