<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Looping the Code</title><link>https://www.infopathdev.com:443/forums/thread/29606.aspx</link><pubDate>Mon, 23 Jun 2008 11:58:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29606</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29606.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29606</wfw:commentRss><description>&lt;p&gt;Hello Thiyagarajan,&lt;/p&gt;
&lt;p&gt;To reduce your code you have to create one secondary file with sourceXPath and destinationXPath fields.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&amp;lt;MappingNodes&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;MappingNode&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Mapping sourceXPath =&amp;quot;&amp;quot; destinationXPath=&amp;quot;&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Mapping sourceXPath =&amp;quot;&amp;quot; destinationXPath=&amp;quot;&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/MappingNode&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/MappingNodes&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Code: Here is the&amp;nbsp;code,&lt;/p&gt;
&lt;p&gt;//Get the list of nodes from secondary dom.&lt;/p&gt;
&lt;p&gt;IXMLDOMNodeList MappingNodes = thisXDocument.GetDOM(&amp;quot;DOM Name&amp;quot;).selectNodes( &amp;quot;/ MappingNodes/MappingNode/Mapping&amp;quot;);&lt;/p&gt;
&lt;p&gt;foreach (IXMLDOMNode MappingNode in MappingNodes)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; {&lt;/p&gt;
&lt;p&gt;//Get the source XPath of node &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;string sourceXPath = MappingNode.selectSingleNode(&amp;quot;@sourceXPath&amp;quot;);&lt;/p&gt;
&lt;p&gt;//Get the destination XPath of node &lt;/p&gt;
&lt;p&gt;string destinationXPath = MappingNode.selectSingleNode(&amp;quot;@destinationXPath&amp;quot;);&lt;/p&gt;
&lt;p&gt;//Get the source value from secondary dom&lt;/p&gt;
&lt;p&gt;string sourceValue = thisXDocument.GetDOM(&amp;quot;DOM Name&amp;quot;).selectSingleNode(sourceXPath);&lt;/p&gt;
&lt;p&gt;//Set the source vlaue to destination node&lt;/p&gt;
&lt;p&gt;thisXDocument.DOM.selecteSingleNode(destinationXPath, sourceValue);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;</description></item><item><title>Looping the Code</title><link>https://www.infopathdev.com:443/forums/thread/29245.aspx</link><pubDate>Mon, 09 Jun 2008 16:22:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29245</guid><dc:creator>thiyagu.KPS</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29245.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29245</wfw:commentRss><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I am developing a tool using Infopath 2007. I do have a XSD schema which contains more than 40 controls with hierarchy. I am able to access each and every controls for populating the XML values by programmatically.But the code is repetative.SO more than 120 lines of code needed.&amp;nbsp;Is there anyway to have the looping method? so that i can shrink my program.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Thiyagarajan N.&lt;/p&gt;</description></item></channel></rss>