public override XmlElement ToXml(XmlContext context) { XmlElement me = context.CreateElement("Domain"); me.Attributes.Append(context.CreateXmlIdAttribute(this)); me.Attributes.Append(context.CreateAttribute("domid", this.Id)); // if (this.Symbol != null) { me.Attributes.Append(context.CreateAttribute("name", this.Symbol.DisplayName)); } // if (this.IsConnected) { me.Attributes.Append(context.CreateAttribute("connection", context.XmlIdOf(this.Connection))); } // if (this.IsComplemented) { me.Attributes.Append(context.CreateAttribute("complemented", "true")); } // // Deal with extended attributes that we didn't print by the above means. // REVIEW: we could do better - try to unify the builtin and non-builtin attrs. // foreach (KeyValuePair<string,EvaluateAttributeOnce> pair in this.DefinedAttrs) { XmlElement domattr = context.CreateElement("DomainAttribute"); domattr.Attributes.Append(context.CreateAttribute("name", pair.Key)); domattr.Attributes.Append(context.CreateAttribute("value", pair.Value.AttributeValue)); me.AppendChild(domattr); } // if (this.Nucleotides!=null && this.Nucleotides.Length > 0) { me.Attributes.Append(context.CreateAttribute("sequence", this.Nucleotides)); } // return me; }