0

I'm having a problem when assigning a value to a Boolean check/tick box within InfoPath xml code. I've created text boxes using inner text values but this gives the error of an incorrect data type. How do you set up a standard check box to a value of true using XmlElement?

Here's the code I attempted to use:

{...
 {...

 XmlElement elShowResult = xDoc.CreateElement("my", "ShowResult", NamespaceManager.LookupNamespace("my"));
 elShowResult.InnerText = "TRUE";

 elNewOrganismDetail.AppendChild(elNewTestResult);

 }
}
//attach the organism entry
//ERROR: Schema validation found non-data type errors.
xpOrganismResultData.AppendChild(elNewOrganismDetail.CreateNavigator()); 

ERROR: InvalidOperationException; Schema validation found non-data type errors.

0

Try this

XmlElement elShowResult = xDoc.CreateElement("my", "ShowResult", NamespaceManager.LookupNamespace("my"));
elNewTestResult.AppendChild(elShowResult);
elNewTestResult.InnerText = "true";
  • did you mean elShowResult.InnerText = "true"; either way seems to throw the same error, fyi added above – Matt Jan 13 '15 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.