SharePoint Developer Center >
SharePoint Products and Technologies Forums
>
SharePoint - Workflow
>
error while reading data from infopath forms.
error while reading data from infopath forms.
- hi i,m developing workflow in sharepoint using VS2005
i have attached a infopath in workflow form as an initiation form
when i run the workflow i get the error saying There is an error in XML document (1, 2).
this is a code which i,m using for getting the data from infopath.
private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
{
workflowId = workflowProperties.WorkflowId;
XmlSerializer serializer = new XmlSerializer(typeof(myfields));
try
{
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(workflowProperties.InitiationData));
myfields Associationfrm = (myfields)serializer.Deserialize(reader);
SPListItem myitem = workflowProperties.Item;
}
catch (Exception ex)
{
throw;
}
}
when i debug the i get the InitiationData in the workflowProperties.InitiationData
as
<my:myFields xml:lang="en-US" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-01-16T10:47:10">
<my:assignee>aa</my:assignee>
</my:myFields>
but
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(workflowProperties.InitiationData));
gives reader as None..
and when debug next line it gives me error
<myFields xmlns='http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-01-16T10:47:10'> was not expected.
i,m stuck..
plz help me out
All Replies
Hi Manish
I get the same Error.
Did you find a solution to the above issue.
When I debug, I get the InitiationData in the workflowProperties, but the line throws a null exception.
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(workflowProperties.InitiationData));
Please let me know if you have any solutions.
Thanks in advance
- Unproposed As Answer byMike Walsh MVPMVP, ModeratorSaturday, May 09, 2009 7:55 AM
- Proposed As Answer byssdeepanj Wednesday, September 17, 2008 9:31 AM
- Unproposed As Answer byMike Walsh MVPMVP, ModeratorSaturday, May 09, 2009 7:55 AM
- Proposed As Answer byssdeepanj Wednesday, September 17, 2008 9:35 AM
- Edited byMike Walsh MVPMVP, ModeratorSaturday, May 09, 2009 7:55 AMPlease urgent removed. These are Forums. Wait.
- Hai Manish,
Please help me.I am also working in workflow.I am also getting the same issue.How to solve this issue.Please send solution of this issue
Thanks
Deepan.J For reference, I had this issue and it was simply because I renamed the class name of my xsd-generated file (but not my root infopath element) and so the Serializer couldn't map the new class name to the old root element name in my InfoPath form. See http://ddkonline.blogspot.com/2009/06/fix-there-is-error-in-xml-document-1-2.html


