Logo Search packages:      
Sourcecode: ndoc version File versions  Download package

void NDoc::Core::Reflection::ReflectionEngine::BuildXml ( XmlWriter  writer  )  [inline, private]

Builds an Xml file combining the reflected metadata with the /doc comments.

Definition at line 187 of file ReflectionEngine.cs.

            {
                  int start = Environment.TickCount;

                  Debug.WriteLine("Memory making xml: " + GC.GetTotalMemory(false).ToString());

                  try
                  {
                        assemblyLoader = SetupAssemblyLoader();

                        string DocLangCode = Enum.GetName(typeof(SdkLanguage), this.rep.SdkDocLanguage).Replace("_", "-");
                        externalSummaryCache = new ExternalXmlSummaryCache(DocLangCode);

                        notEmptyNamespaces = new Hashtable();

                        namespaceHierarchies = new NamespaceHierarchyCollection();
                        baseInterfaces = new BaseInterfacesCollection();
                        derivedTypes = new DerivedTypesCollection();
                        interfaceImplementingTypes = new InterfaceImplementingTypesCollection();
                        attributeFilter = new AttributeUsageDisplayFilter(this.rep.DocumentedAttributes);
                  
                        documentedTypes = new Hashtable();
                  
                        PreReflectionProcess();

                        string currentAssemblyFilename = "";

                        try
                        {
                              // Start the document with the XML declaration tag
                              writer.WriteStartDocument();

                              // Start the root element
                              writer.WriteStartElement("ndoc");
                              writer.WriteAttributeString("SchemaVersion", "1.3");

                              if (this.rep.FeedbackEmailAddress.Length > 0)
                                    WriteFeedBackEmailAddress(writer);

                              if (this.rep.CopyrightText.Length > 0)
                                    WriteCopyright(writer);

                              if (this.rep.IncludeDefaultThreadSafety)
                                    WriteDefaultThreadSafety(writer);

                              if (this.rep.Preliminary)
                                    writer.WriteElementString("preliminary", "");

                              WriteNamespaceHierarchies(writer);

                              foreach (string AssemblyFileName in this.rep.AssemblyFileNames)
                              {
                                    currentAssemblyFilename = AssemblyFileName;
                                    Assembly assembly = assemblyLoader.LoadAssembly(currentAssemblyFilename);

                                    int starta = Environment.TickCount;

                                    WriteAssembly(writer, assembly);

                                    Trace.WriteLine("Completed " + assembly.FullName);
                                    Trace.WriteLine(((Environment.TickCount - starta) / 1000.0).ToString() + " sec.");
                              }

                              writer.WriteEndElement();
                              writer.WriteEndDocument();
                              writer.Flush();

                              Trace.WriteLine("MakeXML : " + ((Environment.TickCount - start) / 1000.0).ToString() + " sec.");

                              // if you want to see NDoc's intermediate XML file, use the XML documenter.
                        }
                        finally
                        {
                              if (assemblyLoader != null)
                              {
                                    assemblyLoader.Deinstall();
                              }
                        }
                  }
                  catch(ReflectionTypeLoadException rtle)
                  {
                        StringBuilder sb = new StringBuilder();
                        if (assemblyLoader.UnresolvedAssemblies.Count>0)
                        {
                              sb.Append("One or more required assemblies could not be located : \n");
                              foreach(string ass in assemblyLoader.UnresolvedAssemblies)
                              {
                                    sb.AppendFormat("   {0}\n",ass);
                              }
                              sb.Append("\nThe following directories were searched, \n");
                              foreach(string dir in assemblyLoader.SearchedDirectories)
                              {
                                    sb.AppendFormat("   {0}\n",dir);
                              }
                        }
                        else
                        {
                              Hashtable fileLoadExceptions = new Hashtable();
                              foreach(Exception loaderEx in rtle.LoaderExceptions)
                              {
                                    System.IO.FileLoadException fileLoadEx = loaderEx as System.IO.FileLoadException;
                                    if (fileLoadEx !=null)
                                    {
                                          if (!fileLoadExceptions.ContainsKey(fileLoadEx.FileName))
                                          {
                                                fileLoadExceptions.Add(fileLoadEx.FileName,null);
                                                sb.Append("Unable to load: " + fileLoadEx.FileName + "\r\n");
                                          }
                                    }
                                    sb.Append(loaderEx.Message + Environment.NewLine);
                                    sb.Append(loaderEx.StackTrace + Environment.NewLine);
                                    sb.Append("--------------------" + Environment.NewLine + Environment.NewLine);
                              }
                        }
                        throw new DocumenterException(sb.ToString());
                  }
            }


Generated by  Doxygen 1.6.0   Back to index