"There is an error in XML document" when attempting to use components generated using XML Schema Generator
Last Updated July 12, 2010
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.
--- 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)
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.
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.
Open XML file in Visual Studio.
On the toolbar menu, click XML / Create Schema, and you’ll see the schema generated in a new tab.
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
Imported Document ID: TECH133441
Subscribing will provide email updates when this Article is updated. Login is required to Subscribe