I am validating XML-Documents with XML-schema-files and the
C#-standard-functions. I have one XSD-document which is syntactically 100%
correct after W3C-standard, but the schema compiler dies with an
InvalidCastException (debug message following).
Has anyone had this error already?
Seems to be a bug inside 'mscorlib'.
Thanks,
Stefan
--
************** Exception Text **************
System.InvalidCastException: Specified cast is not valid.
at System.Xml.Schema.Compiler.CompileContentModel(Com piledContentModel
compiledContentModel, XmlSchemaParticle particle)
at System.Xml.Schema.Compiler.CompileComplexContent(X mlSchemaComplexType
complexType, CompiledContentModel compiledContentModel)
at System.Xml.Schema.Compiler.CompileComplexType(XmlS chemaComplexType
complexType)
at System.Xml.Schema.Compiler.CompileElement(XmlSchem aElement xe)
at System.Xml.Schema.Compiler.CompileTo(SchemaInfo schemaInfo)
at System.Xml.Schema.XmlSchema.Compile(XmlSchemaColle ction collection,
XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler
validationEventHandler, String targetNamespace, SchemaInfo schemaInfo,
Boolean compileContentModel, XmlResolver resolver)
at System.Xml.Schema.XmlSchemaCollection.Add(String ns, SchemaInfo
schemaInfo, XmlSchema schema, Boolean compile, XmlResolver resolver)
at System.Xml.Schema.XmlSchemaCollection.Add(XmlSchem a schema,
XmlResolver resolver)
at System.Xml.Schema.XmlSchemaCollection.Add(XmlSchem a schema)
at XmlValidationDemo.frmXmlValidation.btnLoadValidati onFiles_Click(Object
sender, EventArgs e) in d:\documents and
settings\bjoern\desktop\mosessaurxmlvalidationdemo \xmlvalidationdemo\frmxmlvalidation.cs:line 229
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///d:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll