以下代码引发 XML 反序列化错误 (20,2),我不知道为什么。XmlSerialiser 是否有一些特殊的东西需要了解数据集的反序列化?
Dim strStringReader As StringReader = New StringReader(strValue)
Dim oXS As XmlSerializer = New XmlSerializer(strObjectType)
Deserialize = oXS.Deserialize(strStringReader)
这是 xml(在字符串 strValue 中可用):
<?xml version='1.0' encoding='utf-16'?>
<DataTable>
<xs:schema id='DocumentElement' xmlns='' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='DocumentElement' msdata:IsDataSet='true' msdata:UseCurrentLocale='true'>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element name='tblCategoryLanguageElements'>
<xs:complexType>
<xs:sequence>
<xs:element name='_LE_LanguageID' type='xs:string' minOccurs='0' />
<xs:element name='_LE_FieldID' type='xs:string' minOccurs='0' />
<xs:element name='_LE_Value' type='xs:string' minOccurs='0' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1'>
<DocumentElement>
<tblCategoryLanguageElements diffgr:id='tblCategoryLanguageElements1' msdata:rowOrder='0' diffgr:hasChanges='inserted'>
<_LE_LanguageID>1</_LE_LanguageID>
<_LE_FieldID>1</_LE_FieldID>
<_LE_Value>Components</_LE_Value>
</tblCategoryLanguageElements>
<tblCategoryLanguageElements diffgr:id='tblCategoryLanguageElements2' msdata:rowOrder='1' diffgr:hasChanges='inserted'>
<_LE_LanguageID>1</_LE_LanguageID>
<_LE_FieldID>2</_LE_FieldID>
<_LE_Value>Imported by OT2KARTRISSync</_LE_Value>
</tblCategoryLanguageElements>
<tblCategoryLanguageElements diffgr:id='tblCategoryLanguageElements3' msdata:rowOrder='2' diffgr:hasChanges='inserted'>
<_LE_LanguageID>1</_LE_LanguageID>
<_LE_FieldID>3</_LE_FieldID>
<_LE_Value />
</tblCategoryLanguageElements>
<tblCategoryLanguageElements diffgr:id='tblCategoryLanguageElements4' msdata:rowOrder='3' diffgr:hasChanges='inserted'>
<_LE_LanguageID>1</_LE_LanguageID>
<_LE_FieldID>4</_LE_FieldID>
<_LE_Value />
</tblCategoryLanguageElements>
<tblCategoryLanguageElements diffgr:id='tblCategoryLanguageElements5' msdata:rowOrder='4' diffgr:hasChanges='inserted'>
<_LE_LanguageID>1</_LE_LanguageID>
<_LE_FieldID>5</_LE_FieldID>
<_LE_Value />
</tblCategoryLanguageElements>
<tblCategoryLanguageElements diffgr:id='tblCategoryLanguageElements6' msdata:rowOrder='5' diffgr:hasChanges='inserted'>
<_LE_LanguageID>1</_LE_LanguageID>
<_LE_FieldID>8</_LE_FieldID>
<_LE_Value />
</tblCategoryLanguageElements>
</DocumentElement>
</diffgr:diffgram>
</DataTable>
位置 (20,2) 是这样的:
<diffgr:diffgram xmlns:msdata='urn:sche...
任何帮助表示赞赏!
MadMaxApp