Serialize/Deserialize

  • Thread starter Thread starter Roy
  • Start date Start date
R

Roy

I have a C# class generated by xsd.exe from the xsd file. I also have an xml
file defined by xsd and the root looks like:

<MyNickname:MyObject xmlns:MyNickname="..." xmlns:xsi="..."
xsi:schemaLocation="...">
....

However, these attributes in the root are lost when I deserialize the xml
into the C# file so that if I serialize it back to the xml file again, it
will be different than the original file.
Is that a way to serialize the attributes to the C# class to reserve the
information? I am using both the XmlSerilizer and DataContractSerializer.
 
Maybe I'm not following you, but XSD.exe creates an XML Schema file--that
describes a type. Serialization serializes to XML (in this case). One
snippet of XML describes the type, a the other describes and instance of the
type. They won't have the same attributes.
 
Back
Top