I am designing my class model. The serialized message of the class model needs to be in this format:
<?xml version="1.0" encoding="UTF-8" ?>
<Request>
<Name>TesterScript</Name>
<ID>CD_20110628133820576</ID>
<Type>
<ItemId>191_20110628T133821</ItemId>
<ShopId>MyBCShop</ShopId>
<MessageXml>
<ChildMessage>
This is my message
</ChildMessage>
</MessageXml>
</Type>
<SentTime>2011-06-30T15:27:06-07:00</SentTime>
</Request>
How would I design the classes? Also what should be the best way to serialize the suggested class model to above XML message? I am thinking of using:
// Serialize the request
XmlSerializer xs = new XmlSerializer(typeof(Request));
StringWriter sw = new StringWriter();
xs.Serialize(sw, dispatchRequest);
string xml = sw.ToString();
return new xml;
Is this the most suitable way?