472,145 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Deserializing an object from XML that contains an enum

I'm having an issue in deserializing an object from XML. I generated my XML
schema from my .NET dll using xsd.exe. I've used that schema in another
application. That application spits out XML based on user input and workflow.
It is sending out the integer value for enums instead of the string values.
This seems like it should be the most common sense way to do it (since it's
an easy cast from int to an enum (MyEnum)myInt) but XML deserialization
complains. If I manually edit the XML to contain the strings for those, it
successfully casts the strings into the enum.

Is there a work around other than implementing ISerializable and controlling
the serialization/deserialization of the object manually? I could also alter
the external application, but I'm hoping not to have to waste the effort of
modifying multiple instances if there is an attribute that I can put on the
property that will make it work (or some other fix).
Jun 14 '07 #1
0 2336

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark McConnell | last post: by
5 posts views Thread by Lucas | last post: by
1 post views Thread by john wright | last post: by
1 post views Thread by =?Utf-8?B?SmVyZW15X0I=?= | last post: by
10 posts views Thread by yu_kuo | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.