<?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>Data Connections</title><link>https://www.infopathdev.com:443/forums/44.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25223.aspx</link><pubDate>Wed, 19 Dec 2007 20:21:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25223</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25223.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25223</wfw:commentRss><description>&lt;p&gt;Good idea for making a list - I&amp;#39;ve posted the first two items here and this thread can be used to add more of those whenever they are found:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.infopathdev.com/forums/p/6912/25222.aspx"&gt;http://www.infopathdev.com/forums/p/6912/25222.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25218.aspx</link><pubDate>Wed, 19 Dec 2007 17:39:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25218</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25218.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25218</wfw:commentRss><description>&lt;p&gt;Amazing. Again, thanks.&lt;/p&gt;&lt;p&gt;If anyone has a list of behavioral idiosyncrasies between client and web versions of forms, here&amp;#39;s another: xml files as secondary data sources do not contain the XML declaration or processing instructions in the InfoPath client, but they do in the browser.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25211.aspx</link><pubDate>Wed, 19 Dec 2007 17:02:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25211</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25211.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25211</wfw:commentRss><description>&lt;p&gt;You are correct but here is the interesting thing:&lt;/p&gt;
&lt;p&gt;you don&amp;#39;t need to do any of this hacking on Forms Server - it &lt;strong&gt;seems &lt;/strong&gt;like the navigator you get from the data source has the proper PIs in that case.&lt;/p&gt;
&lt;p&gt;The reason my hack does not work there is because the implementation of the navigator is different.&lt;/p&gt;
&lt;p&gt;Now tell me, what is your actual scenario? :)&lt;/p&gt;
&lt;p&gt;1. If your form is meant to run only on the client, you can use my hack&lt;br /&gt;2. If your form is meant to run only in Forms Server, you don&amp;#39;t need any hacks - the only problem that testing will require deployment all the time&lt;br /&gt;3. If you need both it will be tricky because your business logic links against a client-only DLL that does not exist on your server. You will have to do some late binding work to make sure your own DLL even loads - then you can check if you&amp;#39;re running in the server or not and act accordingly.&lt;/p&gt;
&lt;p&gt;Good luck with all that!&lt;/p&gt;
&lt;p&gt;Dave&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25208.aspx</link><pubDate>Wed, 19 Dec 2007 16:02:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25208</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25208.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25208</wfw:commentRss><description>It did not work for me in Forms Server. Unfortunately, I don&amp;#39;t have access to the server logs, so I can&amp;#39;t do much debugging.&lt;br /&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25207.aspx</link><pubDate>Wed, 19 Dec 2007 15:47:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25207</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25207.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25207</wfw:commentRss><description>&lt;p&gt;You&amp;#39;re welcome!&lt;/p&gt;
&lt;p&gt;I guess I just need to add a disclaimer that the trick&amp;nbsp;relies on the internal implementation of the Navigator so this is not guaranteed to work in future versions of InfoPath (and might actually not even work on Forms Server -&amp;nbsp;to be verified).&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25206.aspx</link><pubDate>Wed, 19 Dec 2007 15:34:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25206</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25206.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25206</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Wow. That works. Suffice to say I would never have figured that out. Thank you so much, David!&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25186.aspx</link><pubDate>Wed, 19 Dec 2007 05:28:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25186</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25186.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25186</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Hey,&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;You are right. In addition to that it turns that you cannot even replace the outer XML of the navigator of the data object so that solution would not work either.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;This problem got me curious so I did some debugging and found a hack that will allow you to do what you need. This involves getting access to the underlying document from the navigator and using it to inject the PIs.&lt;/font&gt;&lt;/p&gt;&lt;b&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;--- Note: this solution requires Full Trust ---&lt;/font&gt;&lt;/font&gt;&lt;/b&gt; 
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;First of all, you will need to add a reference to the IP2003 OM assembly:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;C:\Program Files\Microsoft Office\Office12\Microsoft.Office.Interop.InfoPath.SemiTrust.dll&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Now let&amp;#39;s get to the document:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;"&gt;&lt;font face="Calibri"&gt;XPathNavigator receiveFormY = DataSources[&amp;quot;receiveFormY&amp;quot;].CreateNavigator();&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-language:HE;mso-no-proof:yes;"&gt;// Get the Microsoft.Office.InfoPath.MsxmlNavigator&amp;#39;s member WrappedXmlNode&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2b91af;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-language:HE;mso-no-proof:yes;"&gt;IXMLDOMDocument2&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-language:HE;mso-no-proof:yes;"&gt; document = (&lt;span style="COLOR:#2b91af;"&gt;IXMLDOMDocument2&lt;/span&gt;)receiveFormY.GetType().InvokeMember(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;WrappedXmlNode&amp;quot;&lt;/span&gt;, &lt;span style="COLOR:#2b91af;"&gt;BindingFlags&lt;/span&gt;.GetProperty | &lt;span style="COLOR:#2b91af;"&gt;BindingFlags&lt;/span&gt;.Instance | &lt;span style="COLOR:#2b91af;"&gt;BindingFlags&lt;/span&gt;.NonPublic, &lt;span style="COLOR:blue;"&gt;null&lt;/span&gt;, receiveFormY, &lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;object&lt;/span&gt;[] { });&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;At this point you are holding a fully functional IP2003 document and you can edit it as you please. For example:&lt;/font&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2b91af;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-language:HE;mso-no-proof:yes;"&gt;IXMLDOMNode&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-language:HE;mso-no-proof:yes;"&gt; piNode = document.createProcessingInstruction(&lt;i&gt;piName&lt;/i&gt;, &lt;i&gt;piValue&lt;/i&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-language:HE;mso-no-proof:yes;"&gt;document.insertBefore(piNode, document.documentElement);&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Once you&amp;#39;re done editing, just call Submit() as before:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-bidi-language:HE;mso-no-proof:yes;"&gt;ySubmit.Execute(receiveFormY);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;I am sorry I could not find a more elegant solution for you but this one seems to work (besides the Full Trust requirement). Good luck!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25182.aspx</link><pubDate>Tue, 18 Dec 2007 23:42:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25182</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25182.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25182</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;It turns out that &amp;quot;Only XPathNavigators from a DataObject are allowed&amp;quot; to use Submit Data methods. Great idea, though.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25181.aspx</link><pubDate>Tue, 18 Dec 2007 23:03:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25181</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25181.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25181</wfw:commentRss><description>&lt;p&gt;David,&lt;/p&gt;&lt;p&gt;That&amp;#39;s correct. For whatever reason, CreateNavigator() positions itself at the document element.&lt;/p&gt;&lt;p&gt;The parameterized version of execute allows you to use a data connection to submit data other than the form&amp;#39;s main data source.&lt;/p&gt;&lt;p&gt;I will try option #2 and get back. Thanks for the reply.&lt;/p&gt;&lt;p&gt;Chris&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25142.aspx</link><pubDate>Mon, 17 Dec 2007 06:16:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25142</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25142.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25142</wfw:commentRss><description>&lt;p&gt;Without actually debugging it I could guess that the first CreateNavigator() got positioned at the document element of Form Y, bypassing the PIs.&lt;/p&gt;
&lt;p&gt;Two possible ideas:&lt;/p&gt;
&lt;p&gt;1. Why do you use the version of Execute() that takes a parameter? What will happen if you just called ySubmit.Execute() instead?&lt;/p&gt;
&lt;p&gt;2. If #1 does not work you can try creating a new XmlDocument making sure it has the exact contents you want. Then call CreateNavigator() on this document and pass it to the Execute() method&lt;/p&gt;
&lt;p&gt;(Note: I am not familiar with the semantics of Execute, maybe it&amp;#39;s meant to only submit the document element and not the PIs... then you&amp;#39;d have to look for a different solution)&lt;/p&gt;</description></item><item><title>Modifying another XML file using C#</title><link>https://www.infopathdev.com:443/forums/thread/25135.aspx</link><pubDate>Fri, 14 Dec 2007 22:53:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25135</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25135.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=25135</wfw:commentRss><description>&lt;p&gt;I am new to C# and InfoPath 2007 but pretty experienced with IP2003 and JScript.&lt;/p&gt;&lt;p&gt;One thing I often did in IP2003 was link two forms together programatically - i.e., if a user changes a field in Form X, a field in Form Y was also changed. To do this, I would use two data connections: one to grab Form Y from SharePoint and another to re-submit Form Y to the SharePoint form library. Pretty simple stuff.&lt;/p&gt;&lt;p&gt;For some reason, I can&amp;#39;t figure out how to do this in IP2007/C#. I thought this would work:&lt;/p&gt;&lt;p&gt;XPathNavigator receiveFormY = DataSources[&amp;quot;receiveFormY&amp;quot;].CreateNavigator();&lt;br /&gt;receiveFormY.SelectSingleNode(&amp;quot;//fieldToUpdate&amp;quot;).SetValue(&amp;quot;NewValue&amp;quot;);&lt;br /&gt;FileSubmitConnection ySubmit = (FileSubmitConnection)(DataConnections[&amp;quot;submitFormY&amp;quot;]);&lt;br /&gt;ySubmit.Execute(receiveFormY);&lt;/p&gt;&lt;p&gt;However, the new &amp;quot;Form Y.xml&amp;quot; file has the xml declaration and processing instructions stripped out.&lt;/p&gt;&lt;p&gt;I know this scenario can easily be handled using the DBXL product, but can anyone humor me and tell me what I&amp;#39;m doing wrong with my code?&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>