我需要帮助,我有一些数据进来的XML,我想做一个对象,做一些事情,将它序列化并发送出去... 但它必须是某种自定义序列化。自定义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()
{}
}