Schema validation found non-data type errors - InfoPath Dev
in

InfoPath Dev

Schema validation found non-data type errors

Last post 07-26-2014 11:21 AM by j4m35Tb4k3r. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-06-2012 07:07 AM

    Schema validation found non-data type errors

     

    I am trying to insert rows into a repeating table using code.

    This is the data source for this section.

     

    The Code is erroring at the Writer.Close() line public void Insert_Risk_Analysis_Clicked(object sender, ClickedEventArgs e)

    {

    string myNamespace = NamespaceManager.LookupNamespace("my");

    using (XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode(

    "/my:myFields/my:Activity-Campaign-Overview", NamespaceManager).AppendChild())

    {

    writer.WriteStartElement(
    "Activity-Campaign_Risk_Analysis", myNamespace);

    writer.WriteElementString("Risk_ID", myNamespace, "Cell 1");

    writer.WriteElementString("Risk_Priority", myNamespace, "");

    writer.WriteElementString("Risk_Description", myNamespace, "");

    writer.WriteElementString("Risk_Mitigation_Action", myNamespace, "");writer.WriteElementString("Risk_Remove", myNamespace, "false");

    writer.WriteEndElement();

    writer.Close(); // Error Here

    }

    }

    I have been Searching and have had luck finding any information that will resolve this issue

    Error is text is

    System.InvalidOperationException was unhandled by user code  Message="Schema validation found non-data type errors."  Source="Microsoft.Office.InfoPath.Client.Internal.Host.Interop"  StackTrace:       at Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromMsxmlInteropError(MsxmlInteropError eError)       at Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromHresult(Int32 hrError)       at Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlNodeImpl.AppendChild(String strXml)       at Microsoft.Office.InfoPath.MsxmlWriter.Close()       at System.Xml.XmlWellFormedWriter.Close()       at Portfolio_Requirements.FormCode.Insert_Risk_Analysis_Clicked(Object sender, ClickedEventArgs e)       at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

    Thanks

    James

  • 12-06-2012 08:14 AM In reply to

    Re: Schema validation found non-data type errors

    From the bottom sliver of your screenshot it looks like Activity-Campaign_Risk_Analysis has at least one sibling underneath Activity-Campaign-Overview, so your code is inserting the new Activity-Campaign_Risk_Analysis node after that field (and possibly others) instead of in line with the rest of the Activity-Campaign_Risk_Analysis.

    It's for reasons like this that we advocate giving repeating groups their own exclusive non-repeating parent group, so that they don't have any siblings.  Are you at a stage in your development cycle where you can rearrange your data source to meet that requirement?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-14-2012 02:00 PM In reply to

    Re: Schema validation found non-data type errors

    Thank you Jimmy you were completely right. I am still pretty new to using XMLwriter

    I have been spinning my wheels on getting the 2 sections of the Scheme correct to make it run properly. any help would be appreciated.

    Thanks

    James

  • 07-26-2014 11:21 AM In reply to

    Re: Schema validation found non-data type errors

    "giving repeating groups their own exclusive non-repeating parent group, so that they don't have any siblings" - Very, very helpful. Thank you!
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.