Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hello friends,
Facing some problem with XML deserialisation. Please help:

1) I have a XSD file, which i convert into a CS file using XSD tool. Tried to use this CS file in my project to deserialize a XML file (generated from the same XSD file). By doing this, iam getting error like "Cannot convert to type CLASSNAME" [or] sometimes "Error in reading or type mismatch in xml (1234, 223) - some line number"
[Or] "There was an error reflecting type 'CLASSNAME'."

I Guess this happens due to any mismatch in mapping of different classes and objects to the provided XML file (input).

2) In our 2nd attempt we took the XML file, Created a XSD out of it using "Create Schema' of Visual Studio and used this XSD to auto generate the CS file.
If we use this new CS file and try to deserialize the same XML file, it works PERFECT.

NOTE: The XSD in previous method has "xsd:"tags whereas the XSD generated by Visual Studio in 2nd method has "xs:" tags. Will this create any difference when we auto generate a CS file out of these? AFAIK xsd or xs doesnt matter, they dont play any role.

Please suggest.
Thanks,
Dinesh
Posted
Comments
Maciej Los 11-May-15 11:40am    
Help what? What's the issue?
[no name] 12-May-15 2:44am    
Issue is:
We dont want to use the XSD file generated from a XML file for auto generating CS file.
We want to use the XSD file (directly provided by client) for auto generating CS file, as explained in point 1. But we are getting error doing this.
Any idea what could be wrong or anyone who has faced any similar problems.
Maciej Los 12-May-15 3:17am    
We can't read in your mind or direct from yor screeen. Please, improve question and add related xml structure and class definition. Then we'll be able to help you.
[no name] 12-May-15 3:23am    
Both XSD and XML file are very big in size and cannot be attached over here. Can you plz provide ur email id, so that i can send u those.
Maciej Los 12-May-15 3:30am    
Sorry, but this does not work like that. Use external server for file sharing, but note that some members don't like to download unknown resources. Please, create sample to reproduce your issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900