private Paragraph ReadParagraphTextContent(Paragraph paragraph)
{
try
{
if (this._debugMode)
this.LogNode(paragraph.Node, "Log Paragraph node before");
ArrayList mixedContent = new ArrayList();
foreach(XmlNode nodeChild in paragraph.Node.ChildNodes)
{
//Check for IText content first
TextContentProcessor tcp = new TextContentProcessor();
IText iText = tcp.CreateTextObject(this._document, nodeChild.CloneNode(true));
if (iText != null)
mixedContent.Add(iText);
else
{
//Check against IContent
IContent iContent = this.CreateContent(nodeChild);
if (iContent != null)
mixedContent.Add(iContent);
}
}
//Remove all
paragraph.Node.InnerXml = "";
foreach(Object ob in mixedContent)
{
if (ob is IText)
{
if (this._debugMode)
this.LogNode(((IText)ob).Node, "Log IText node read");
paragraph.TextContent.Add(ob as IText);
}
else if (ob is IContent)
{
if (this._debugMode)
this.LogNode(((IContent)ob).Node, "Log IContent node read");
//paragraph.Content.Add(ob as IContent);
AddToCollection(ob as IContent, paragraph.Content);
}
else
{
this.OnWarning(new AODLWarning("Couldn't determine the type of a paragraph child node!.", paragraph.Node));
}
}
if (this._debugMode)
this.LogNode(paragraph.Node, "Log Paragraph node after");
return paragraph;
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to create the Paragraph content.", ex);
}
}