Wednesday, August 13, 2008

Type: SchemaValidationException, Exception Message: Schema validation found non-datatype errors.

If you get that error when opening an infopath form after programmatically editing the form, you need to set the PreserveWhitespace property to true:

XmlDocument myDoc = new XmlDocument();
myDoc.PreserveWhitespace = true;
myDoc.Load(myInStream);

2 comments:

JP said...

I love you!! That solved my problem.

Kipper said...

I just beat my head against the wall for several hours on an InfoPath 2010 project doing similar stuff. a few google searches and I found the answer on my own blog from three years ago. I have to go home and get some sleep or something.