I have a problem with creating the appropriate class to deserialize the xml file. The xml structure looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" target-language="pl" datatype="plaintext" original="1112">
<body>
<group id="90362">
<trans-unit id="90362::aff_11">
<source>text 1 1</source>
<target>text 1 1</target>
</trans-unit>
<trans-unit id="90362::aff_12">
<source>text 1 2</source>
<target>text 1 2</target>
</trans-unit>
<trans-unit id="90362::aff_13">
<source>text 1 3</source>
<target>text 1 3</target>
</trans-unit>
</group>
<group id="90392">
<trans-unit id="90392::aff_21">
<source>text 2 1</source>
<target>text 2 1</target>
</trans-unit>
<trans-unit id="90392::aff_22">
<source>text 2 2</source>
<target>text 2 2</target>
</trans-unit>
<trans-unit id="90392::aff_23">
<source>text 2 3</source>
<target>text 2 3</target>
</trans-unit>
</group>
</body>
</file>
</xliff>
As you can see, we have nested arrays within arrays. In addition, one of the arrays has a name that cannot be given the same name for the class. Pre-created classes:
[XmlRoot("xliff", Namespace = "urn:oasis:names:tc:xliff:document:1.2")]
public class xliff
{
public file file { get; set; }
}
public class file
{
public body body { get; set; }
}
public class body : List<group>
{
public List<group> groups { get; set; }
}
public class group //: List<trans>
{
public List<trans> trans { get; set; }
}
public class trans
{
[XmlElement("source")]
public string source { get; set; }
[XmlElement("target")]
public string target { get; set; }
}
Unfortunately, I have a problem to complete classes to get to source and target values.