That worked perfectly. Just to finish the thread, DeSerializing is very similar I just use reader.ReadStartElement() to skip past the first element and then deserialize my class.
Thanks! Brian -----Original Message----- From: Marsh, Drew [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 02, 2002 4:16 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] XmlSerializer - how to add an extra element to the x ml Brian Weeres [mailto:[EMAIL PROTECTED]] wrote: > I am trying to add an additional element in my xml when > serializing a class using XmlSerializer but I cannot figure > out how to do it. I *believe* this can be achieved by using on of the XmlSerializer::Serialize overloads which take an XmlWriter and writing root node with the XmlWriter manually... like so: <codeSnippet language="C#"> XmlWriter writer = new XmlTextWriter(...); writer.WriteStartDocument(); writer.WriteStartElement("myRootNode"); XmlSerializer serializer = new XmlSerializer(...); serializer.Serialize(writer, myInstance); writer.WriteEndElement(); writer.WriteEndDocument(); </codeSnippet> HTH, Drew You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
