title: Implementing IXmlSerializable on a generated class that has XmlTypeAttribute
body: <p>Basically, the initial problem is I need to make a boolean value serialize as 0 or 1. The solution I found was to implement IXmlSerializable, which I did. Unfortunately the class I'm trying to serialize is generated code off a schema and has an XmlTypeAttribute on it. When I try to (de)serialize the object with the XmlSerializer created in the usual manner ( <code>new XmlSerializer(type)</code>) it throws this exception:</p>
  
  <p><code>System.InvalidOperationException: Only XmlRoot attribute may be specified for the type ______ Please use XmlSchemaProviderAttribute to specify schema type.</code></p>
  
  <p>Two options come to mind immediatly:</p>
  
  <p>1) remove the attribute in the generated code.
  This change would have to be made every time the code was re-generated.</p>
  
  <p>2) Use an XmlAttributeOverrides object when creating the serializer to remove the attribute. This would require the rest of the code base to "know" that it needs to override that attribute. Also, the exception thrown gives absolutly no clue as to what needs to be done to fix it.</p>
  
  <p>Both options kinda stink. Is there a third option?</p>