views:

155

answers:

0

Hi all,

I’m using XmlSerializer to deserialize complex object, using XSD auto-generated classes. But when it comes to enumeration, there is some problem,

I want some attribute to be restricted to specific values, such as:

  <xs:simpleType name="choiceType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Yes"/>
      <xs:enumeration value="No" />
      <xs:enumeration value="N/A" />
    </xs:restriction>
  </xs:simpleType>

But what XSD generate is only enumerations but not string with restricted values. How can I deal with that? Thanks in advance!