Author: jonpryor
Date: 2006-10-06 09:33:02 -0400 (Fri, 06 Oct 2006)
New Revision: 66349

Modified:
   trunk/monodoc/engine/ChangeLog
   trunk/monodoc/engine/ecma-provider.cs
Log:
        * ecma-provider.cs: Properly handle situation when
          index.xml/Overview/Types/Namespace/Type/@DisplayName doesn't exist
          (Removes NullReferenceException).


Modified: trunk/monodoc/engine/ChangeLog
===================================================================
--- trunk/monodoc/engine/ChangeLog      2006-10-06 13:12:44 UTC (rev 66348)
+++ trunk/monodoc/engine/ChangeLog      2006-10-06 13:33:02 UTC (rev 66349)
@@ -1,5 +1,11 @@
 2006-10-06  Jonathan Pryor  <[EMAIL PROTECTED]>
 
+       * ecma-provider.cs: Properly handle situation when
+         index.xml/Overview/Types/Namespace/Type/@DisplayName doesn't exist
+         (Removes NullReferenceException).
+
+2006-10-06  Jonathan Pryor  <[EMAIL PROTECTED]>
+
        * ecma-provider.cs: Add support for generic types.  
          Use RootTree.GetNamespaceAndType() to do the namespace/type 
splitting.  
          Add support to "escape" generic types, converting e.g. F<T,U> into 

Modified: trunk/monodoc/engine/ecma-provider.cs
===================================================================
--- trunk/monodoc/engine/ecma-provider.cs       2006-10-06 13:12:44 UTC (rev 
66348)
+++ trunk/monodoc/engine/ecma-provider.cs       2006-10-06 13:33:02 UTC (rev 
66349)
@@ -41,10 +41,17 @@
        
        public static string GetClassName (XmlDocument doc)
        {
-               string name = doc.SelectSingleNode ("/Type").Attributes 
["DisplayName"].InnerText;
-               return name.Replace("+", ".");
+               return GetDisplayName (doc.SelectSingleNode ("/Type")).Replace 
("+", ".");
        }
 
+       public static string GetDisplayName (XmlNode type)
+       {
+               if (type.Attributes ["DisplayName"] != null) {
+                       return type.Attributes ["DisplayName"].Value;
+               }
+               return type.Attributes ["Name"].Value;
+       }
+
        public static string GetClassAssembly (XmlDocument doc)
        {
                return doc.SelectSingleNode 
("/Type/AssemblyInfo/AssemblyName").InnerText;
@@ -1786,7 +1793,7 @@
                        bool has_types = false;
                        foreach (XmlElement t in ns.SelectNodes("Type")) {
                                has_types = true;
-                               string typename = 
t.GetAttribute("DisplayName").Replace("+", ".");
+                               string typename = EcmaDoc.GetDisplayName 
(t).Replace("+", ".");
                                
                                // Must load in each document to get the list 
of members...
                                XmlDocument typedoc = new XmlDocument();
@@ -1896,7 +1903,7 @@
                        foreach (XmlNode node in nodes) {
                                XmlElement ns = summary.CreateElement 
("namespace");
                                XmlAttribute attr = summary.CreateAttribute 
("ns");
-                               attr.Value = 
node.Attributes["DisplayName"].Value;
+                               attr.Value = EcmaDoc.GetDisplayName (node);
                                ns.Attributes.Append (attr);
                                elements.AppendChild (ns);
                        }
@@ -1940,7 +1947,7 @@
                        }
                        
                        XmlElement typenode = elements.CreateElement(typekind);
-                       typenode.SetAttribute("name", 
t.GetAttribute("DisplayName").Replace ('+', '.'));
+                       typenode.SetAttribute("name", EcmaDoc.GetDisplayName 
(t).Replace ('+', '.'));
                        typenode.SetAttribute("fullname", ns + "." + 
t.GetAttribute("Name"));
                        
typenode.AppendChild(elements.ImportNode(typedoc.SelectSingleNode("Type/Docs/summary"),
 true));
                        

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to