Hi All,
Being new to .NET and XML, I am facing a few challenges but one in particular has me stumped. We received an xsd file from an exchange partner, which has booleans defined as simpleType, restriction boolean and with acceptable values of o and 1. When loading this into C#, the subsuequent class generated creates booleans as expected. But since booleans in C# are only True/False, the created XML based on the xsd fails validation. Here is a snippet of the pieces which cause the problem:
<xsd:element name="IsActive" type="Switch" minOccurs="0"/>
:
:
<xsd:simpleType name="Switch">
<xsd:annotation>
<xsd:documentation>0</xsd:documentation>
<xsd:documentation> Only the values 0 and 1 are allowed.
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:boolean">
<xsd:pattern value="[0-1]{1}"/>
</xsd:restriction>
</xsd:simpleType>
OK, so my question is, is this a bug in .NET serializer or is it a fault in the xsd design?
Thanks indeed for any helpful comments. Hopefully I have provided enough info.