我下載了XML Schema for XML Schemas,地址爲http://www.w3.org/2001/XMLSchema.xsd。如何在創建XmlSerializer對象時排除此異常?
然後我用XSD.EXE從下載的文件創建一個類。我打電話給班級schema.cs
。
我再執行這行代碼:
XmlSerializer serializer = new XmlSerializer(typeof(schema));
,並得到這個錯誤:
The XML element 'annotation' from namespace 'http://www.w3.org/2001/XMLSchema' is already present in the current scope.
如何找到重複的元素,並修復它,不破壞模式?
可能是例外有一個行號和位置號碼。你可以添加這些嗎? – 2010-10-27 17:26:59
@Pieter:異常不包括行號,內部異常也沒有。 – 2010-10-27 17:35:48
而你根本沒有提示什麼註釋會拋出?我已經看過XSD,看起來好像有很多有多個註釋的範圍。 – 2010-10-27 17:38:59