public Header CreateHeader(XmlNode headernode)
{
try
{
if (this._debugMode)
this.LogNode(headernode, "Log header node before");
//Create a new Header
Header header = new Header(headernode, this._document);
//Create a ITextCollection
ITextCollection textColl = new ITextCollection();
//Recieve the HeaderStyle
IStyle headerStyle = this._document.Styles.GetStyleByName(header.StyleName);
if (headerStyle != null)
header.Style = headerStyle;
//Create the IText content
foreach(XmlNode nodeChild in header.Node.ChildNodes)
{
TextContentProcessor tcp = new TextContentProcessor();
IText iText = tcp.CreateTextObject(this._document, nodeChild);
if (iText != null)
textColl.Add(iText);
else
{
this.OnWarning(new AODLWarning("Couldn't create IText object from header child node!.", nodeChild));
}
}
//Remove all
header.Node.InnerXml = "";
foreach(IText iText in textColl)
{
if (this._debugMode)
this.LogNode(iText.Node, "Log IText node read from header");
header.TextContent.Add(iText);
}
return header;
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to create a Header.", ex);
}
}