public override void DoOutput ()
		{
			if (document == null)
				throw new InvalidOperationException ("Document not set");

			XmlNode nclass = document.CreateElement ("class", null);
			AddAttribute (nclass, "name", type.Name);
			string classType = GetClassType (type);
			AddAttribute (nclass, "type", classType);

			if (type.BaseType != null)
				AddAttribute (nclass, "base", Utils.CleanupTypeName (type.BaseType));

			if (type.IsSealed)
				AddAttribute (nclass, "sealed", "true");

			if (type.IsAbstract)
				AddAttribute (nclass, "abstract", "true");

			if (type.IsSerializable)
				AddAttribute (nclass, "serializable", "true");

			string charSet = GetCharSet (type);
			AddAttribute (nclass, "charset", charSet);

			string layout = GetLayout (type);
			if (layout != null)
				AddAttribute (nclass, "layout", layout);

			if (type.PackingSize >= 0) {
				AddAttribute (nclass, "pack", type.PackingSize.ToString ());
			}

			if (type.ClassSize >= 0) {
				AddAttribute (nclass, "size", type.ClassSize.ToString ());
			}

			parent.AppendChild (nclass);

			AttributeData.OutputAttributes (document, nclass, GetCustomAttributes(type));

			XmlNode ifaces = null;

			foreach (TypeReference iface in  TypeHelper.GetInterfaces (type)) {
				if (!TypeHelper.IsPublic (iface))
					// we're only interested in public interfaces
					continue;

				if (ifaces == null) {
					ifaces = document.CreateElement ("interfaces", null);
					nclass.AppendChild (ifaces);
				}

				XmlNode iface_node = document.CreateElement ("interface", null);
				AddAttribute (iface_node, "name", Utils.CleanupTypeName (iface));
				ifaces.AppendChild (iface_node);
			}

			MemberData.OutputGenericParameters (document, nclass, type);

			ArrayList members = new ArrayList ();

			FieldDefinition [] fields = GetFields (type);
			if (fields.Length > 0) {
				Array.Sort (fields, MemberReferenceComparer.Default);
				FieldData fd = new FieldData (document, nclass, fields);
				members.Add (fd);
			}

			if (type.IsEnum) {
				var value_type = GetEnumValueField (type);
				if (value_type == null)
					throw new NotSupportedException ();

				AddAttribute (nclass, "enumtype", Utils.CleanupTypeName (value_type.FieldType));
			}

			if (!Driver.AbiMode) {

				MethodDefinition [] ctors = GetConstructors (type);
				if (ctors.Length > 0) {
					Array.Sort (ctors, MemberReferenceComparer.Default);
					members.Add (new ConstructorData (document, nclass, ctors));
				}

				PropertyDefinition[] properties = GetProperties (type);
				if (properties.Length > 0) {
					Array.Sort (properties, MemberReferenceComparer.Default);
					members.Add (new PropertyData (document, nclass, properties));
				}

				EventDefinition [] events = GetEvents (type);
				if (events.Length > 0) {
					Array.Sort (events, MemberReferenceComparer.Default);
					members.Add (new EventData (document, nclass, events));
				}

				MethodDefinition [] methods = GetMethods (type);
				if (methods.Length > 0) {
					Array.Sort (methods, MemberReferenceComparer.Default);
					members.Add (new MethodData (document, nclass, methods));
				}
			}

			foreach (MemberData md in members)
				md.DoOutput ();

			var nested = type.NestedTypes;
			//remove non public(familiy) and nested in second degree
			for (int i = nested.Count - 1; i >= 0; i--) {
				TypeDefinition t = nested [i];
				if ((t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic ||
					(t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily ||
					(t.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem) {
					// public
					if (t.DeclaringType == type)
						continue; // not nested of nested
				}

				nested.RemoveAt (i);
			}


			if (nested.Count > 0) {
				XmlNode classes = document.CreateElement ("classes", null);
				nclass.AppendChild (classes);
				foreach (TypeDefinition t in nested) {
					TypeData td = new TypeData (document, classes, t);
					td.DoOutput ();
				}
			}
		}
		public override void DoOutput ()
		{
			if (document == null)
				throw new InvalidOperationException ("Document not set");

			XmlNode nassembly = document.CreateElement ("assembly", null);
			AssemblyNameDefinition aname = ass.Name;
			AddAttribute (nassembly, "name", aname.Name);
			AddAttribute (nassembly, "version", aname.Version.ToString ());
			parent.AppendChild (nassembly);
			TypeForwardedToData.OutputForwarders (document, nassembly, ass);
			AttributeData.OutputAttributes (document, nassembly, ass.CustomAttributes);
			var typesCollection = ass.MainModule.Types;
			if (typesCollection == null || typesCollection.Count == 0)
				return;
			object [] typesArray = new object [typesCollection.Count];
			for (int i = 0; i < typesCollection.Count; i++) {
				typesArray [i] = typesCollection [i];
			}
			Array.Sort (typesArray, TypeReferenceComparer.Default);

			XmlNode nss = document.CreateElement ("namespaces", null);
			nassembly.AppendChild (nss);

			string current_namespace = "$%&$&";
			XmlNode ns = null;
			XmlNode classes = null;
			foreach (TypeDefinition t in typesArray) {
				if (string.IsNullOrEmpty (t.Namespace))
					continue;

				if (!Driver.AbiMode && ((t.Attributes & TypeAttributes.VisibilityMask) != TypeAttributes.Public))
					continue;

				if (t.DeclaringType != null)
					continue; // enforce !nested

				if (t.Namespace != current_namespace) {
					current_namespace = t.Namespace;
					ns = document.CreateElement ("namespace", null);
					AddAttribute (ns, "name", current_namespace);
					nss.AppendChild (ns);
					classes = document.CreateElement ("classes", null);
					ns.AppendChild (classes);
				}

				TypeData bd = new TypeData (document, classes, t);
				bd.DoOutput ();
			}
		}