Groups | Blog | Home
all groups > dotnet xml > june 2004 >

dotnet xml : xsd.exe and XmlType?



Bradley Plett
6/4/2004 6:12:11 PM
I have a relatively simple xsd which I am turning into a class using
"xsd.exe". I then create a collection of these classes. I have run
into one minor problem. When serializing my collection, I would like
the names of the elements to be different from the class name as
generated by xsd.exe. I don't want to change the class name itself,
due to naming conventions. This is trivial to do after-the-fact by
adding the "XmlType" tag to the signature of the class. However, when
I regenerate from the xsd, the tag disappears. Is there some way of
putting the "XmlType" information into the xsd so that xsd.exe
maintains it? Alternatively, is there an easy way to rename the
elements when serializing?

Thanks!
Yan Leshinsky
6/4/2004 8:48:39 PM
Following is a detailed description on how to do that:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlserializationxmlattributeoverridesclasstopic.asp

[quoted text, click to view]

Bradley Plett
6/9/2004 3:14:51 PM
I have been unable to make that sample work for a class that inherits
from a collection. Any further help or examples would be much
appreciated!

Thanks!
Brad.

On Fri, 4 Jun 2004 20:48:39 -0700, "Yan Leshinsky"
[quoted text, click to view]
AddThis Social Bookmark Button