public override void WriteStartAttribute (string prefix, string localName, string ns)
{
CheckState ();
if (state != WriteState.Element)
throw new XmlException ("Cannot write attribute as this XmlDictionaryWriter is not at element state");
if (!String.IsNullOrEmpty (ns))
throw new ArgumentException ("Non-empty namespace URI is not allowed in this XmlDictionaryWriter");
if (!String.IsNullOrEmpty (prefix))
throw new ArgumentException ("Non-empty prefix is not allowed in this XmlDictionaryWriter");
if (localName != "type" && localName != "__type")
throw new ArgumentException ("Only 'type' and '__type' are allowed as an attribute name in this XmlDictionaryWriter");
if (state != WriteState.Element)
throw new InvalidOperationException (String.Format ("Attribute cannot be written in {0} mode", state));
attr_name = localName;
state = WriteState.Attribute;
}