<?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: XPath Issue - MoveToChild() Doesn't Seem To Work</title><link>https://www.infopathdev.com:443/forums/thread/88859.aspx</link><pubDate>Thu, 11 Apr 2013 14:10:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:88859</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/88859.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=88859</wfw:commentRss><description>&lt;p&gt;Update:&amp;nbsp; I solved the issue this AM.&amp;nbsp; Did more googling once I had a chance to wrap my head around what was failing (nil=true was the cause).&amp;nbsp; I found this link that explains the issue:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/office/bb509311(v=office.12).aspx"&gt;http://msdn.microsoft.com/en-us/library/office/bb509311(v=office.12).aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Essentially you have to delete the nil attribute before you set the value.&amp;nbsp; I used the method listed in the article:&lt;/p&gt;&lt;pre&gt;        public void DeleteNil(XPathNavigator node)
        {
            if (node.MoveToAttribute(
               &amp;quot;nil&amp;quot;, &amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;))
                node.DeleteSelf();
        }
&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;And now it works! :)&lt;br /&gt;&lt;br /&gt;R.&lt;/pre&gt;</description></item><item><title>XPath Issue - MoveToChild() Doesn't Seem To Work</title><link>https://www.infopathdev.com:443/forums/thread/88853.aspx</link><pubDate>Thu, 11 Apr 2013 04:35:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:88853</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/88853.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=88853</wfw:commentRss><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I have a XPathNavigator object that is set at 1 node of a repeating group&amp;nbsp;in my main data source.&amp;nbsp; In actuality it is in an OnChanged event in the code behind for that note.&amp;nbsp; I type text in 1 field, when OnChanged fires, it adjusts the text, queries DB then sets another 2 fields.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I use the following code to set the two fields, but it keeps failing on the 2nd SetValue() call with the exception: &amp;quot;&amp;#39;xnTypedAccount.SetValue()&amp;#39; threw an exception of type &amp;#39;System.InvalidOperationException&amp;#39;&amp;quot;.&amp;nbsp; Stack trace message is&lt;em&gt;&lt;strong&gt;: Schema validation found non-data type errors.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;          string namespaceURI = xnTypedAccount.NamespaceURI; //xnTypedAccount is the XpathNavigator object passed as an arg to my Changed event.             
                xnTypedAccount.MoveToParent(); //go up to parent node.
                xnTypedAccount.MoveToChild(&amp;quot;ActAccountToCharge&amp;quot;, namespaceURI); //come back down to 1st sibling we are setting.
                xnTypedAccount.SetValue(accountNum); //set value to be queried value.
                xnTypedAccount.MoveToParent(); //back up&lt;strong&gt;&lt;em&gt;
                xnTypedAccount.MoveToChild(&amp;quot;ActJobNum&amp;quot;, namespaceURI); //back down to 2nd sibling (this is where the exception happens).&lt;/em&gt;&lt;/strong&gt;
&lt;/pre&gt;

&lt;p&gt;&lt;font size="2"&gt;Can someone tell me how to set this field?&amp;nbsp;I do notice that if the datatype of that field is &amp;quot;Integer&amp;quot; it fails... if I change it to be text it works... suspect it is the xsi:nill attribute but not sure why.&amp;nbsp; It is an integer field so I want to keep it as integer for shredding etc.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;My parent nodes&amp;nbsp;&amp;quot;outerxml&amp;quot; is:&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;lt;my:OrderItemCoding xmlns:my=\&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-02-22T21:06:27\"&gt;http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-02-22T21:06:27\&lt;/a&gt;&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;my:CodingItemIdx&amp;gt;1&amp;lt;/my:CodingItemIdx&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;my:QtyOrdered&amp;gt;&amp;lt;/my:QtyOrdered&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;my:ActAccountToCharge&amp;gt;&amp;lt;/my:ActAccountToCharge&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;my:ReqAcctToCharge&amp;gt;104609&amp;lt;/my:ReqAcctToCharge&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;my:ActJobNum xmlns:my=\&amp;quot;&lt;/strong&gt;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-02-22T21:06:27\"&gt;&lt;strong&gt;http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-02-22T21:06:27\&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&amp;quot; xmlns:xsi=\&amp;quot;&lt;/strong&gt;&lt;a href="http://www.w3.org/2001/XMLSchema-instance\"&gt;&lt;strong&gt;http://www.w3.org/2001/XMLSchema-instance\&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&amp;quot; xsi:nil=\&amp;quot;true\&amp;quot;&amp;gt;&amp;lt;/my:ActJobNum&amp;gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;/my:OrderItemCoding&amp;gt;&lt;/p&gt;&lt;p&gt;(with \r\n\t\t\t\t\t\t text removed for cleanliness).&lt;/p&gt;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Also... if I edit the field first and put in some misc. data... it seems to be able to be updated properly after that.&amp;nbsp; Why is it that the field must be typed in before it can be set programatically?&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Rob&lt;/p&gt;
&lt;font size="2"&gt;&lt;/font&gt;</description></item></channel></rss>