"There is an error in XML document" when attempting to use components generated using XML Schema Generator
search cancel

"There is an error in XML document" when attempting to use components generated using XML Schema Generator

book

Article ID: 152527

calendar_today

Updated On:

Products

Workflow Solution

Issue/Introduction

When attempting to use components generated using the XML Schema Generator an error similiar to the following may be encountered.

System.InvalidOperationException: There is an error in XML document (1, 23). ---> System.InvalidOperationException: <LinkResources xmlns=''> was not expected.

   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderlink.Read3_link()

--- End of inner exception stack trace ---

   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)

   at Generated.Graham_XML_Generator.linkRead.Run(IData data)

Cause

In all instances where this has been seen the cause of the issue is the XML schema file (XSD file) used in the component generation not being formatted properly for the XML file being read by the component.

Resolution

The solution is to generate a new XSD file using the XML file you are attempting to parse as a template.  Once this has been done, recreate the XML Schema Generator components using the new XSD file.

Generating a new XSD file can be accomplished using Microsoft Visual Studio 2005 or 2008 using the instructions below.  Note:  If you do not have Visual Studio the free Express versions that Microsoft offers can be used as well.
  1.  Open XML file in Visual Studio.
  2. On the toolbar menu, click XML / Create Schema, and you’ll see the schema generated in a new tab.
  3. Right-click on the tab name and choose “Save <name>.xsd

 Now, run the XML Schema generator wizard in Workflow again, but this time generate against the newly-created .xsd. 


Applies To
Workflow 7.0