I'm currently working on a .NET 4.6 console application. I try to parse/serialize a XML from a file.
Currently I'm struggling with the serialization of a Complex Type in XML.
Given is the following XML element:
<cool_element>
<master visible="true">A1</master>
</cool_element>
as well as it's according XSD specification:
<xs:element name="cool_element">
<xs:complexType>
<xs:sequence>
<xs:element name="master">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="visible"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
My serialization class in C# looks like this:
[XmlRoot(ElementName = "cool_element")]
public class CoolElement
{
[XmlElement("master")]
public string Master { get; set; }
}
This works fine to retrieve the string value. But I don't know how to get the attribute visible from my master element.
Do you have an idea on how to solve this?
Thank you!