0

i have an xsd we use with the XMLSerializer class in .net to generte an xml document. We have the following type with a default value

  <xs:complexType name="telephoneType">
<xs:simpleContent>
  <xs:extension base="xs:string">
    <xs:attribute name="type" default="BH">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="BH"/>
          <xs:enumeration value="AH"/>
          <xs:enumeration value="mobile"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:extension>
</xs:simpleContent>

It seems like when we set the value to BH which is the default it does not include the attribute in the document. is there a way to always include these?

Ryan Burnham
  • 2,619
  • 3
  • 27
  • 43

1 Answers1

0

The serialiser will not create the element/attribute when the property is equal to its default value. There is going to be little to do unless you create a custom method to serialize your objects.

ChrisBint
  • 12,773
  • 6
  • 40
  • 62