private static void ParseTableColumnsInfo(XmlTextReader xamlReader)
        {
            mst_tableColumnsInfoActual = new TableColumnsInfo();

            while (ReadNextToken(xamlReader) && xamlReader.NodeType != XmlNodeType.EndElement)
            {
                if (xamlReader.Name.ToLower() == "tablecolumn")
                {
                    string strWidth = xamlReader.GetAttribute("Width");
                    if (!String.IsNullOrEmpty(strWidth))
                    {
                        mst_tableColumnsInfoActual.AddTableColumnInfo(new TableColumnInfo(strWidth.ToLower() == "auto" ? double.NaN : Convert.ToDouble(strWidth)));
                    }
                }
            }
            //if (xamlReader.NodeType == XmlNodeType.EndElement)
            //{
            //    ReadNextToken(xamlReader);
            //}
        }
        /// <summary>
        /// Converts a xaml element into an appropriate html element.
        /// </summary>
        /// <param name="xamlReader">
        /// On entry this XmlTextReader must be on Element start tag;
        /// on exit - on EndElement tag.
        /// </param>
        /// <param name="htmlWriter">
        /// May be null, in which case we are skipping xaml content
        /// without producing any html output
        /// </param>
        /// <param name="inlineStyle">
        /// StringBuilder used for collecting css properties for inline STYLE attributes on every level.
        /// </param>
        private static void WriteElement(XmlTextReader xamlReader, XmlTextWriter htmlWriter, StringBuilder inlineStyle)
        {
            Debug.Assert(xamlReader.NodeType == XmlNodeType.Element);

            if (htmlWriter == null)
            {
                // Skipping mode; recurse into the xaml element without any output
                WriteElementContent(xamlReader, /*htmlWriter:*/ null, null, string.Empty);
            }
            else
            {
                string htmlElementName = null;

                switch (xamlReader.Name)
                {
                case "Run":
                case "Span":
                    //htmlElementName = "SPAN";
                    htmlElementName = (xamlReader.IsEmptyElement ? "BR" : "SPAN");
                    break;

                case "InlineUIContainer":
                    htmlElementName = "SPAN";
                    break;

                case "Bold":
                    htmlElementName = "B";
                    break;

                case "Italic":
                    htmlElementName = "I";
                    break;

                case "Paragraph":
                    htmlElementName = (xamlReader.IsEmptyElement ? "BR" : "DIV");
                    //htmlElementName = "P";
                    break;

                case "BlockUIContainer":
                    htmlElementName = "DIV";
                    break;

                case "Section":
                    htmlElementName = "DIV";
                    break;

                case "Table":
                    htmlElementName = "TABLE";
                    break;

                case "TableColumn":
                    htmlElementName = "COL";
                    break;

                case "TableRowGroup":
                    htmlElementName = "TBODY";
                    break;

                case "TableRow":
                    htmlElementName  = "TR";
                    mst_iCurTableRow = 0;
                    break;

                case "TableCell":
                    htmlElementName = "TD";
                    break;

                case "List":
                    string marker = xamlReader.GetAttribute("MarkerStyle");
                    if (marker == null || marker == "None" || marker == "Disc" || marker == "Circle" || marker == "Square" || marker == "Box")
                    {
                        htmlElementName = "UL";
                    }
                    else
                    {
                        htmlElementName = "OL";
                    }
                    break;

                case "ListItem":
                    htmlElementName = "LI";
                    break;

                case "Hyperlink":
                    htmlElementName = "A";
                    break;

                case "Image":
                    htmlElementName = "IMG";
                    break;

                case "Path":
                    htmlElementName = "HR";
                    break;

                default:
                    htmlElementName = null;     // Ignore the element
                    break;
                }

                if (htmlWriter != null && htmlElementName != null)
                {
                    htmlWriter.WriteStartElement(htmlElementName);

                    if (null != mst_tableColumnsInfoActual && htmlElementName == "TD" && !double.IsNaN(mst_tableColumnsInfoActual.Width))
                    {
                        TableColumnInfo tci = mst_tableColumnsInfoActual.GetTableColumnInfo(mst_iCurTableRow);
                        htmlWriter.WriteAttributeString("width", mst_tableColumnsInfoActual.GetTableColumnInfo(mst_iCurTableRow).Width.ToString());
                        htmlWriter.WriteAttributeString("align", "left");
                        htmlWriter.WriteAttributeString("vAlign", "top");

                        mst_iCurTableRow++;
                    }

                    //### Formating properties
                    WriteFormattingProperties(xamlReader, htmlWriter, inlineStyle);

                    WriteElementContent(xamlReader, htmlWriter, inlineStyle, htmlElementName);

                    if (null != mst_tableColumnsInfoActual && htmlElementName == "TABLE")
                    {
                        mst_tableColumnsInfoActual.Clear();
                        mst_tableColumnsInfoActual = null;
                        mst_iCurTableRow           = 0;
                    }

                    htmlWriter.WriteEndElement();
                }
                else
                {
                    // Skip this unrecognized xaml element
                    WriteElementContent(xamlReader, /*htmlWriter:*/ null, null, string.Empty);
                }
            }
        }