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.
Here is my class.
public class TestClass
{
public TestClass()
{
}
[XmlAttributeAttribute]
public string ClassID = "123";
public string Name = "Bob";
public int Language = 1;
}
Here is my ouput
<?xml version="1.0" encoding="utf-16"?>
<TestClass ClassID="123"">
<Name>Bob</Name>
<Language>1</Language>
</TestClass>"
Here is what I want:
<?xml version="1.0" encoding="utf-16"?>
<ANOTHERNODE>
<TestClass ClassID="123"">
<Name>Bob</Name>
<Language>1</Language>
</TestClass>"
</ANOTHERNODE>
How can I add "ANOTHERNODE"? I can accomplish this if I create another
class that has a member variable of TestClass and serialize that class
but I would like to do it just using TestClass if possible.
Thanks for any help.
Brian
Brian
----------------------------------------
Brian Weeres
Protegra Technology Group
www.protegra.com
Unit 2-55 Henlow Bay, Winnipeg MB R3Y 1G4
General: (204) 956-2727
Direct: (204) 487-5654
Fax: (204) 477-9421
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.