private Table CreateTable(XmlNode tableNode)
{
try
{
//Create a new table
Table table = new Table(this._document, tableNode);
ContentCollection iColl = new ContentCollection();
//Recieve the table style
IStyle tableStyle = this._document.Styles.GetStyleByName(table.StyleName);
if (tableStyle != null)
table.Style = tableStyle;
else
{
this.OnWarning(new AODLWarning("Couldn't recieve a TableStyle.", tableNode));
}
//Create the table content
foreach(XmlNode nodeChild in table.Node.ChildNodes)
{
IContent iContent = this.CreateContent(nodeChild);
if (iContent != null)
{
//iColl.Add(iContent);
AddToCollection(iContent, iColl);
}
else
{
this.OnWarning(new AODLWarning("Couldn't create IContent from a table node. Content is unknown table content!", iContent.Node));
}
}
table.Node.InnerText = "";
foreach(IContent iContent in iColl)
{
if (iContent is Column)
{
((Column)iContent).Table = table;
table.ColumnCollection.Add(iContent as Column);
}
else if (iContent is Row)
{
((Row)iContent).Table = table;
table.Rows.Add(iContent as Row);
}
else if (iContent is RowHeader)
{
((RowHeader)iContent).Table = table;
table.RowHeader = iContent as RowHeader;
}
else
{
table.Node.AppendChild(iContent.Node);
this.OnWarning(new AODLWarning("Couldn't create IContent from a table node.", tableNode));
}
}
return table;
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to create a Table.", ex);
}
}