Schema validation found non-data type errors in InfoPath

We could get the above error while trying to set value for a field using XPathNavigator. The reason could be that the field has the nil attribute set

Most of the fields with the exception of String Type uses nil to indicate “no value”.

So before we could set the value for those fields, we need to remove the nil attribute from it.

We could use the below code for that.

XPathNavigator node= MainDataSource.CreateNavigator()

.SelectSingleNode(“/my:myFields/my:lblSpecHours”, NamespaceManager);

if (node.MoveToAttribute(“nil”,”))





Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

One thought on “Schema validation found non-data type errors in InfoPath”

  1. Hi,

    I have the error which you have described above and was directed to your site from a MSDN forum. I am not a programmer and the code I am using is copied from a solution on a MSDN article.

    As I am not a programmer I’m unsure as to how to apply your solution. When I pasted it into my Visual Studio solution it didn’t ‘like’ it, but I think it is down to the language – mine is in C#, is yours in VB?

    Can you provide some assistance if I send you the code?



Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.