1

Topic: XMLSerializer to change element level

Let's admit is entering XML


<A>

<A1> value </A1>

<A2> value </A2>

</A>

<B>

<B1> value </B1>

<B2> value </B2>

</B>


It is necessary to deserialise it in object a trace. Type:




public class Obj 
{ 
   public string A1; 
   public string A2; 
   public string B1; 
   public string B2; 
}



It is possible to make it regular means through  or it will be necessary xslt to do conversion.

2

Re: XMLSerializer to change element level

Hello, the Anonymous author, you wrote:

Let's admit is entering XML

...

It is necessary to deserialise it in object a trace. Type:

...

It is possible to make it regular means through  or it will be necessary xslt to do conversion.


I often do so: I describe the xsd-scheme for xml with which I will work. In PreBuild  I put a generation command under the circuit C# classes, and in PostBuild - generation of the assembly with xml-serializatorami.


Accordingly, xml  in the generated classes. Further, to write on C# the conversion code of one classes to others there is more convenient occupation, than a support of circuits and other conversions xml. First of all at such approach finite classes which should turn out after deserialising have superimposed xml-serializatorom no restrictions.