I am having a problem re-serializing my information back into InfoPath.
I have serialized out the form by first using xsd.exe to get the classes for the mySchema.xsd file created by InfoPath. I have marked the anyAttrField as [System.NonSerialized] and I deserialize infopath using the following:
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
using (Stream documentStream = infoPathFormDocument.OpenBinaryStream())
{
_infoPathData = (MyClass)serializer.Deserialize(documentStream);
}
Once I make changes to the object, I want to serialize it back in. I have tried first saving out the processing instructions and then putting them back in; my form now gets all of the correct values if you open the form, however all of my promoted fields are completely blank! If I just go through an XMLDocument and update the values using XPath, everything is fine. So I'm thinking that it has to do with the format of the class or how it re-serializes it.
Has anyone successfully re-serialized the document back in to InfoPath after changing the object?
Thanks
Sue H