Question about XML deserialization in .net

I am trying to deserialize the XML that comes from a web service, but I don't know how to tell the serializer how to edit this xml fragment:

<Movimientos>
<Movimientos>
<NOM_ASOC>pI22E7P30KWB9KeUnI+JlMRBr7biS0JOJKo1JLJCy2ucI7n3MTFWkY5DhHyoPrWs</NOM_ASOC>
<FEC1>RZq60KwjWAYPG269X4r9lRZrjbQo8eRqIOmE8qa5p/0=</FEC1>
<IDENT_CLIE>IYbofEiD+wOCJ+ujYTUxgsWJTnGfVU+jcQyhzgQralM=</IDENT_CLIE>
</Movimientos>
<Movimientos>

As you can see, the child tag uses the same tags as its parent element, I believe that this is wrong, but the web service is provided by an external company and does not change it, is there any way or some library to organize XML or how can I use an attribute in my class so that the serializer gets it right? Thanks for any help.

+3
source share
2 answers

- , , , , , . XmlElementAttribute :

[XmlRoot("Movimientos")]
public class Movimientos
{
    [XmlElement("Movimientos")]
    public SomeOtherClass SomeOtherProperty { get; set; }
}

public class SomeOtherClass
{
    public string NOM_ASOC { get; set; }
    public string FEC1 { get; set; }
    public string IDENT_CLIE { get; set; }
}

FYI, XML ; , , . , , .

+5

XML- .Net, , . System.Xml System.Xml.Linq().

0

Source: https://habr.com/ru/post/1745189/


All Articles