Custom XML Serialization, how to write custom root element?

Posted by Beta033 on Stack Overflow See other posts from Stack Overflow or by Beta033
Published on 2010-03-15T23:43:45Z Indexed on 2010/03/15 23:49 UTC
Read the original article Hit count: 384

Filed under:
|
|
|

I'm probably just doing this wrong, i know.

i'm using custom serialization and when the xml is generated it's putting the class name as the root element

Example:

<MyClassName>
 <MyIntendedRootNode>
   <ObjectType>
     <Property1/>
     <Property2/>
...

I'm inoking the serialization by calling xmlserializer.Serialize(writer,Me) so i'm sure that has something to do with it.

I've tried putting XMLRoot onto the class, but i think as vb is compiling this partial class with it's aspx page, it's either overwriting this property or ignoring it entirely.

ideally i'd like to just tell it to either throw away everything it has and use a different root element.

Anybody else do this except me?

Thanks

© Stack Overflow or respective owner

Related posts about .NET

Related posts about xml-serialization