<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: What's the easiest way to poke data into a form?</title><link>https://www.infopathdev.com:443/forums/thread/13729.aspx</link><pubDate>Fri, 07 Oct 2005 00:18:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13729</guid><dc:creator>RobW</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13729.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13729</wfw:commentRss><description>Hey Thanks!&lt;br /&gt;&lt;br /&gt;Whilst your suggestion didn't directly resolve the issue, it has put me on the right path.&lt;br /&gt;&lt;br /&gt;Always interesting to see how others approach similar problems - I hadn't considered the view element.&lt;br /&gt;&lt;br /&gt;Thanks again!</description></item><item><title>Re: What's the easiest way to poke data into a form?</title><link>https://www.infopathdev.com:443/forums/thread/13728.aspx</link><pubDate>Thu, 06 Oct 2005 12:28:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13728</guid><dc:creator>vt_asparagus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13728.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13728</wfw:commentRss><description>I believe you are correct in your assessment, but I have not tried that code above.  I created a form not that long ago that did a lot of work with a custom task pane and moved data captured from there over.  This is what I did.  This method will take a string of XML and a the path to where it should be inserted.&lt;br /&gt;&lt;br /&gt;Sub CreateRow(sXML, sParentNodePath)&lt;br /&gt;	&lt;br /&gt;	'Create a new row&lt;br /&gt;	dim oXml &lt;br /&gt;	set oXml = XDocument.CreateDOM()&lt;br /&gt;	oXml.async = false&lt;br /&gt;	oXml.loadXML(sXML)&lt;br /&gt;	&lt;br /&gt;	'add the row to the DOM&lt;br /&gt;	XDocument.DOM.selectSingleNode(sParentNodePath).appendChild(oXml.documentElement)&lt;br /&gt;	&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;For instance if my XML structure was &amp;lt;Policies&amp;gt;&amp;lt;Policy&amp;gt;&amp;lt;/Policy&amp;gt;&amp;lt;Policy&amp;gt;&amp;lt;/Policy&amp;gt;&amp;lt;/Policies&amp;gt;&lt;br /&gt;&lt;br /&gt;sXML = "&amp;lt;Policy&amp;gt;&amp;lt;/Policy&amp;gt;"&lt;br /&gt;sParentNodePath = "//Policies"&lt;br /&gt;&lt;br /&gt;From a maintainability standpoint this code is not the best, I personally do not like it because the XML string gets hard coded into your script or managed code and if you schema gets modified, you must remember to go modify this code.&lt;br /&gt;&lt;br /&gt;Another thing you could look into is the Call XDocument.View.ExecuteAction using the "xCollection::insert" parameter.  This method does not suffer from the disadvantage that I mentioned above.</description></item><item><title>What's the easiest way to poke data into a form?</title><link>https://www.infopathdev.com:443/forums/thread/12604.aspx</link><pubDate>Thu, 06 Oct 2005 06:51:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12604</guid><dc:creator>RobW</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12604.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12604</wfw:commentRss><description>Hi all,&lt;br /&gt;&lt;br /&gt;First post from a new to infopath member. Apologies if this is covered elsewhere&lt;br /&gt;&lt;br /&gt;I'm trying to do somethiing very similar to the structural editing sample form in the developer's reference. Basically, I want to select some data from a list of values in the task pane and pass the selected items back into the forms xml. No worries with any of the task pane stuff; I have the DHTML all working and know all about window.external.Window. XDocument to pass the selections back in.&lt;br /&gt;&lt;br /&gt;The problem I am having is in inserting the selections into the forms underlying xml.&lt;br /&gt;&lt;br /&gt;I can think of two ways of doing it. One is to access the node I want to change via the DOM property of the XDocument along the lines of:&lt;br /&gt;&lt;br /&gt;var Dom = Xdocument.DOM;&lt;br /&gt;var contextnode = Dom.selectSingleNode("//my:context");&lt;br /&gt;var newnode = dom.createNode(1, "my:context", "my:");&lt;br /&gt;contextnode.parentNode.appendChild(newnode);&lt;br /&gt;&lt;br /&gt;But when I try this I get a complaint that the node is 'unexpected'. What does that mean? Is it unable to be validated against the schema or is it a namespace clash?&lt;br /&gt;&lt;br /&gt;The other way is to try to retrieve the node definition from the manifest a la the example in the structural editing form. Trouble is, the sample form creates an enormous selectSingleNode XPath statement that terminates in something like "chooseFragment[@parent ='blah']". When I examine my .xsf file the parent attribute is nowhere to be found, instead the subtree is under an 'innerFragment' attribute. &lt;br /&gt;&lt;br /&gt;The .xsf reference is circular at best in the way it explains things and I am stuck. Could someone please tell me the best way to simply insert nodes into my form's XML?&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Rob&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;&lt;/font id="blue"&gt;&lt;font color="blue"&gt;&lt;/font id="blue"&gt;</description></item></channel></rss>