我需要帮助,我有一些以xml格式传入的数据,我想将其转换为对象,进行处理,然后将其序列化并发送出去...但它必须是某种自定义的序列化。
XML格式如下:
<Animals Ver="12" class="1" something="2">
<Dog Ver="12" class="2" something="17">
<Name> a </Name>
<Sound> oof </Sound>
<SomeOtherProp>12</SomeOtherProp>
</Dog>
<Cat Ver="12" class="3" something="4">
<Name> b </Name>
<Sound> meow </Sound>
</Cat>
</Animals>
需要呈现为:
abstract class Animal :XmlMagic
{
public string Name{get;set;}
public string Sound{get;set;}
public void SomeMagicalXMLSerializationMethod()
{}
public void SomeMagicalXMLDeSerializationMethod()
{}
}
class Dog: Animal, XmlMagic
{
public int SomeOtherProp{get;set;}
public void SomeMagicalXMLSerializationMethod()
{}
public void SomeMagicalXMLDeSerializationMethod()
{}
}