<?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: Cannot add attribute</title><link>https://www.infopathdev.com:443/forums/thread/78370.aspx</link><pubDate>Tue, 08 May 2012 13:55:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78370</guid><dc:creator>jsherman</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78370.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78370</wfw:commentRss><description>&lt;p&gt;I will try what you posted above for iterating through the datsource.. Thanks.. &lt;/p&gt;&lt;p&gt;As for your above solution.. I see it doesn&amp;#39;t work on attributes but I was orignally trying to create an attribute on a field to store the info i needed to.. So instead of storing it in the attribute i am storing it in the node proerty for that field.. Seems like it should work well..&lt;/p&gt;</description></item><item><title>Re: Cannot add attribute</title><link>https://www.infopathdev.com:443/forums/thread/78364.aspx</link><pubDate>Tue, 08 May 2012 05:25:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78364</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78364.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78364</wfw:commentRss><description>&lt;p&gt;I believe that &lt;strong&gt;MainDataSource.CreateNavigator.Select(&amp;quot;//*[not(*)]&amp;quot;)&lt;/strong&gt; should provide you with an XPathNodeIterator that lists all of the leaf elements in the main data source.&amp;nbsp; It won&amp;#39;t include attributes, but according to the documentation I linked you to, Get/SetNamedNodeProperty doesn&amp;#39;t work on attributes.&lt;/p&gt;</description></item><item><title>Re: Cannot add attribute</title><link>https://www.infopathdev.com:443/forums/thread/78356.aspx</link><pubDate>Mon, 07 May 2012 18:19:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78356</guid><dc:creator>jsherman</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78356.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78356</wfw:commentRss><description>&lt;p&gt;I just checked those out and I am pretty sure it will work great.. Thank you very much...&lt;/p&gt;&lt;p&gt;Now perhaps you can assist with 1 more problem during this adventure.. How can I build a loop that will iterate through each field in the form??&lt;/p&gt;</description></item><item><title>Re: Cannot add attribute</title><link>https://www.infopathdev.com:443/forums/thread/78346.aspx</link><pubDate>Mon, 07 May 2012 16:09:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78346</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78346.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78346</wfw:commentRss><description>&lt;p&gt;InfoPath will produce an error like that if you try to add an XML node to the main data source that is not defined in the schema.&amp;nbsp; This has nothing to do with xsi:nil.&lt;/p&gt;&lt;p&gt;If you&amp;#39;re looking to set and retrieve metadata properties to arbitrary fields, perhaps the SetNamedNodeProperty/GetNamedNodeProperty API is the way to go:&lt;/p&gt;&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.datasource.setnamednodeproperty.aspx"&gt;http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.datasource.setnamednodeproperty.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.datasource.getnamednodeproperty.aspx"&gt;http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.datasource.getnamednodeproperty.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Cannot add attribute</title><link>https://www.infopathdev.com:443/forums/thread/78342.aspx</link><pubDate>Mon, 07 May 2012 14:24:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78342</guid><dc:creator>jsherman</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78342.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78342</wfw:commentRss><description>&lt;p&gt;The error is&lt;/p&gt;&lt;p&gt;&amp;nbsp;Schema validation found non-data type errors.&lt;/p&gt;&lt;p&gt;No the IsDirty attribute is not defined. I am attempting to add it to the data source only if a user changes the value within the field.. Essentially I am trying to make a per field IsDirty functionality.. Really in general I just want to know how to add an attribute that doe snot exist in the data source at run time via VB.net code...&lt;/p&gt;</description></item><item><title>Re: Cannot add attribute</title><link>https://www.infopathdev.com:443/forums/thread/78333.aspx</link><pubDate>Sat, 05 May 2012 15:40:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78333</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78333.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78333</wfw:commentRss><description>&lt;p&gt;What is the actual error that you are getting?&amp;nbsp; Does your data source define RequestType as having an attribute named IsDirty?&lt;/p&gt;</description></item><item><title>Cannot add attribute</title><link>https://www.infopathdev.com:443/forums/thread/78326.aspx</link><pubDate>Fri, 04 May 2012 19:28:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78326</guid><dc:creator>jsherman</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78326.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78326</wfw:commentRss><description>&lt;p&gt;Hello&lt;/p&gt;

&lt;p&gt;&amp;nbsp; I am trying to create &amp;quot;IsDirty&amp;quot; logic for each field in my form. I want to create a sub-routine that will create an attribute on a field if it doesn&amp;#39;t already exist and set the value to true.. I plan to call the sub on field change.. I keep getting schema validation errors as thought it had the nil attribute.. Can an attribute have an attribute?? Why would it be nil if I am supplying a value upon creation?? How do I add an attribute to a field via VB code?&lt;/p&gt;&lt;p&gt;The code for thesub is below:&lt;/p&gt;

&lt;p&gt;
        Public Sub Dirty_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)&lt;br /&gt;
           &amp;nbsp;&amp;nbsp; If Not Me.SQLLoadActive Then&lt;br /&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim dom As XPathNavigator = MainDataSource.CreateNavigator()&lt;br /&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case dom.SelectSingleNode(&amp;quot;/my:myFields/my:RequestInfo/my:RequestType&amp;quot;, NamespaceManager).Value&lt;br /&gt;
                   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case &amp;quot;Add&amp;quot;&lt;br /&gt;
                   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case &amp;quot;Change&amp;quot;&lt;br /&gt;
                       &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If e.NewValue &amp;lt;&amp;gt; e.OldValue Then&lt;br /&gt;
                           &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Site.CreateAttribute(e.Site.Prefix, &amp;quot;IsDirty&amp;quot;, NamespaceManager.LookupNamespace(&amp;quot;my&amp;quot;), System.String.Empty)&lt;br /&gt;
                           &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(e.Site.Name &amp;amp; &amp;quot; - &amp;quot; &amp;amp; e.OldValue &amp;amp; &amp;quot; - &amp;quot; &amp;amp; e.NewValue)&lt;br /&gt;
                       &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;
                   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case &amp;quot;Obsolete&amp;quot;&lt;br /&gt;
               &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select&lt;br /&gt;
           &amp;nbsp;&amp;nbsp; End If&lt;br /&gt;
        End Sub&lt;br /&gt;
&lt;/p&gt;</description></item></channel></rss>