我需要幫助,我有一些數據進來的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()
{}
}