<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re-Serializing InfoPath file after having DeSerialized it</title><link>https://www.infopathdev.com:443/forums/thread/43516.aspx</link><pubDate>Fri, 26 Jun 2009 18:47:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:43516</guid><dc:creator>SusanH</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/43516.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=43516</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;I am having a problem re-serializing my information back into InfoPath.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;I have serialized out the form by first using xsd.exe to get the classes for the mySchema.xsd file created by InfoPath.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;I have marked the anyAttrField as [System.NonSerialized] and I deserialize infopath using the following:&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XmlSerializer&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; serializer = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XmlSerializer&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;typeof&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;MyClass&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;));&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;using&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Stream&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; documentStream = infoPathFormDocument.OpenBinaryStream())&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _infoPathData = (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;MyClass&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)serializer.Deserialize(documentStream);&lt;br /&gt;}&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;Once I make changes to the object, I want to serialize it back in.&amp;nbsp; 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!&amp;nbsp;&amp;nbsp; If I just go through an XMLDocument and update the values using XPath, everything is fine.&amp;nbsp; So I&amp;#39;m thinking that it has to do with the format of the class or how it re-serializes it.&lt;/p&gt;
&lt;p&gt;Has anyone successfully re-serialized the document back in to InfoPath after changing the object?&lt;/p&gt;
&lt;p&gt;Thanks&lt;br /&gt;Sue H&lt;/p&gt;</description></item></channel></rss>