private SDToken GetSeeRef(XmlDocumentationElement xmlElement)
        {
            try
            {
                var sdToken = new SDSeeToken();

                if (xmlElement.ReferencedEntity != null)
                {
                    var identifier = xmlElement.ReferencedEntity.DeclaringType != null
                                            ? xmlElement.ReferencedEntity.DeclaringType.GetIdentifier()
                                            : string.Empty;

                    sdToken.Name = xmlElement.ReferencedEntity.Name;
                    sdToken.Namespace = xmlElement.ReferencedEntity.Namespace;
                    sdToken.DeclaringType = identifier;
                    sdToken.Text = xmlElement.ReferencedEntity.Name;
                }
                else
                {
                    sdToken.Name = xmlElement.GetAttribute("cref");
                }

                return sdToken;
            }
            catch (Exception)
            {
                return null;
            }
        }
		public void AddDocumentationElement(XmlDocumentationElement element)
		{
			if (element == null)
				throw new ArgumentNullException("element");
			if (element.IsTextNode) {
				AddText(element.TextContent);
				return;
			}
			switch (element.Name) {
				case "b":
					AddSpan(new Bold(), element.Children);
					break;
				case "i":
					AddSpan(new Italic(), element.Children);
					break;
				case "c":
					AddSpan(new Span { FontFamily = GetCodeFont() }, element.Children);
					break;
				case "code":
					AddCodeBlock(element.TextContent);
					break;
				case "example":
					if (ShowExample)
						AddSection("Example: ", element.Children);
					break;
				case "exception":
					if (ShowExceptions)
						AddException(element.ReferencedEntity, element.Children);
					break;
				case "list":
					AddList(element.GetAttribute("type"), element.Children);
					break;
					//case "note":
					//	throw new NotImplementedException();
				case "para":
					AddParagraph(new Paragraph { Margin = new Thickness(0, 5, 0, 5) }, element.Children);
					break;
				case "param":
					if (ShowAllParameters || (ParameterName != null && ParameterName == element.GetAttribute("name")))
						AddParam(element.GetAttribute("name"), element.Children);
					break;
				case "paramref":
					AddParamRef(element.GetAttribute("name"));
					break;
				case "permission":
					if (ShowPermissions)
						AddPermission(element.ReferencedEntity, element.Children);
					break;
				case "preliminary":
					if (ShowPreliminary)
						AddPreliminary(element.Children);
					break;
				case "remarks":
					if (ShowRemarks)
						AddSection("Remarks: ", element.Children);
					break;
				case "returns":
					if (ShowReturns)
						AddSection("Returns: ", element.Children);
					break;
				case "see":
					AddSee(element);
					break;
				case "seealso":
					if (inlineCollection != null)
						AddSee(element);
					else if (ShowSeeAlso)
						AddSection(new Run("See also: "), () => AddSee(element));
					break;
				case "summary":
					if (ShowSummary)
						AddSection("Summary: ", element.Children);
					break;
				case "threadsafety":
					if (ShowThreadSafety)
						AddThreadSafety(ParseBool(element.GetAttribute("static")), ParseBool(element.GetAttribute("instance")), element.Children);
					break;
				case "typeparam":
					if (ShowTypeParameters)
						AddSection("Type parameter " + element.GetAttribute("name") + ": ", element.Children);
					break;
				case "typeparamref":
					AddText(element.GetAttribute("name"));
					break;
				case "value":
					if (ShowValue)
						AddSection("Value: ", element.Children);
					break;
				case "exclude":
				case "filterpriority":
				case "overloads":
					// ignore children
					break;
				case "br":
					AddLineBreak();
					break;
				default:
					foreach (var child in element.Children)
						AddDocumentationElement(child);
					break;
			}
		}
 private void AddResultsSection(Dictionary<string, SDTokenList> results, XmlDocumentationElement xmlElement)
 {
     if (!string.IsNullOrEmpty(xmlElement.GetAttribute("httpCode")))
     {
         results.Add(xmlElement.GetAttribute("httpCode"), ParseContentTokens(xmlElement));
     }
     else if(!results.ContainsKey("default"))
     {
         results.Add("default", ParseContentTokens(xmlElement));
     }
 }
		void AddSee(XmlDocumentationElement element)
		{
			IEntity referencedEntity = element.ReferencedEntity;
			if (referencedEntity != null) {
				if (element.Children.Any()) {
					Hyperlink link = new Hyperlink();
					link.Click += CreateNavigateOnClickHandler(referencedEntity);
					AddSpan(link, element.Children);
				} else {
					AddInline(ConvertReference(referencedEntity));
				}
			} else if (element.GetAttribute("langword") != null) {
				AddInline(new Run(element.GetAttribute("langword")) { FontFamily = GetCodeFont() });
			} else if (element.GetAttribute("href") != null) {
				Uri uri;
				if (Uri.TryCreate(element.GetAttribute("href"), UriKind.Absolute, out uri)) {
					if (element.Children.Any()) {
						AddSpan(new Hyperlink { NavigateUri = uri }, element.Children);
					} else {
						AddInline(new Hyperlink(new Run(element.GetAttribute("href"))) { NavigateUri = uri });
					}
				}
			} else {
				// Invalid reference: print the cref value
				AddText(element.GetAttribute("cref"));
			}
		}