Support for [XmlType] Attribute?
We are trying to use XSerializer in place of the System.Xml.Serialization because of some weird behavior we are experiencing with a few XML docs. In trying XSerializer we discovered it wasn't recognizing the [XmlType] attribute on a model.
Here is some information to help explain our use case. As you can see below, in the XML there is a Location node that has two address elements and each address element has a type attribute with a different value.
...
<Location>
<Address type="Text">
<AddressLine languageID="en-US" sequence="1">123 Street Name</AddressLine>
<CityName>City</CityName>
<CountrySubDivisionCode>FL</CountrySubDivisionCode>
<CountryCode>US</CountryCode>
<PostalCode>12345</PostalCode>
</Address>
<Address type="Discrete">
<BuildingNumber>123</BuildingNumber>
<StreetName>Steet Name</StreetName>
<CityName>City</CityName>
<CountrySubDivisionCode>FL</CountrySubDivisionCode>
<CountryCode>US</CountryCode>
<PostalCode>12345</PostalCode>
</Address>
</Location>
/...
We only care about the Address with type "Text", so when using System.Xml.Serialization to deserialize we were able to do
[XmlRoot(ElementName = "Address")]
[XmlType("Text")]
public class Address
{...
on the address model in order to tell it to only deserialize the Address element of type "Text". When we switched to XSerializer, it appeared at first as if it wasn't deserializing the AddressLine in the Address node we care about. After doing a test were I removed the "Discrete" Address type manually from the XML I discovered that it was just being overwritten with null because AddressLine does not exist in the "Discrete" type.
There are ways to work around this, like removing the Address of type "Discrete" from the XML before processing, but it would be nice to have the [XmlType] attribute recognized by XSerializer to avoid needing to manually manipulate the XML.