in src/Microsoft.OpenApi.CSharpAnnotations.DocumentGeneration/Extensions/XElementExtensions.cs [31:80]
public static string GetDescriptionText(this XElement element)
{
var description = new StringBuilder();
var children = element.Nodes();
foreach (var child in children)
{
switch (child.NodeType)
{
case XmlNodeType.Text:
description.Append(child);
break;
case XmlNodeType.CDATA:
description.Append(child.ToString()
.Replace("<![CDATA[", string.Empty).Replace("]]>", string.Empty));
break;
case XmlNodeType.Element:
var childElement = (XElement) child;
switch (childElement.Name.ToString())
{
case KnownXmlStrings.Para:
description.Append(GetDescriptionText(childElement));
break;
case KnownXmlStrings.See:
description.Append(childElement.Attribute(KnownXmlStrings.Cref)?.Value);
break;
case KnownXmlStrings.Seealso:
description.Append(childElement.Attribute(KnownXmlStrings.Cref)?.Value);
break;
case KnownXmlStrings.Paramref:
description.Append(childElement.Attribute(KnownXmlStrings.Name)?.Value);
break;
case KnownXmlStrings.Typeparamref:
description.Append(childElement.Attribute(KnownXmlStrings.Name)?.Value);
break;
}
break;
}
}
return description.ToString().Trim().RemoveBlankLines();
}