Skip to content

Commit

Permalink
Fix icsharpcode#244: Add CDATA Support to DocumentationElement.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrunwald committed Nov 6, 2013
1 parent bf08a76 commit b55866d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,18 @@ public void DocumentationAboveAttributeInRegion()
class Test { }");
Assert.AreEqual("<summary/>", typeDefinition.Documentation.ToString());
}

[Test]
public void CDATAInDocumentation()
{
Init(@"using System;
/// <summary>before<![CDATA[<xml/>]]>after</summary>
class Test { }
");
var element = XmlDocumentationElement.Get(typeDefinition);
Assert.AreEqual(1, element.Children.Count());
Assert.AreEqual("summary", element.Children[0].Name);
Assert.AreEqual("before<xml/>after", element.Children[0].TextContent);
}
}
}
4 changes: 4 additions & 0 deletions ICSharpCode.NRefactory.Xml/DocumentationElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,13 @@ static List<XmlDocumentationElement> CreateElements(IEnumerable<AXmlObject> chil
List<XmlDocumentationElement> list = new List<XmlDocumentationElement>();
foreach (var child in childObjects) {
var childText = child as AXmlText;
var childTag = child as AXmlTag;
var childElement = child as AXmlElement;
if (childText != null) {
list.Add(new XmlDocumentationElement(childText.Value, declaringEntity));
} else if (childTag != null && childTag.IsCData) {
foreach (var text in childTag.Children.OfType<AXmlText>())
list.Add(new XmlDocumentationElement(text.Value, declaringEntity));
} else if (childElement != null) {
if (nestingLevel < 5 && childElement.Name == "inheritdoc") {
string cref = childElement.GetAttributeValue("cref");
Expand Down

0 comments on commit b55866d

Please sign in to comment.