c# Incorrect XML to deserialize
-
11-10-2019 - |
سؤال
I have this XML, and i need deserialize but type is incorrect.
<Consumer>
<Sex type="int">Man</Sex>
</Consumer>
How could i fix out? I like to allow int and string.
Thx in advance,
المحلول
The only way you are going to accomplish this is by manually parsing the XML.
All of the regular tools are going to throw a fit over the fact that "Man" is by no means an integer.
نصائح أخرى
Please doing folowing action. Load your XML into Visual Studio, click the "Infer Schema" button, and run "xsd.exe /c schema.xsd" to generate the classes. xsd.exe is in the tools folder. Then go through the generated code and make adjustments, such as changing shorts to ints where appropriate.
check this link
لا تنتمي إلى StackOverflow