private static PDFDataSchema DoPopulateDataSchema(DataSet dataset, PDFDataContext context)
        {
            string dsName    = dataset.DataSetName;
            string dsXmlName = System.Xml.XmlConvert.EncodeLocalName(dsName);

            System.Data.DataTable[] tables   = GetTopLevelTables(dataset);
            List <PDFDataItem>      topItems = new List <PDFDataItem>();

            foreach (System.Data.DataTable table in tables)
            {
                string tableName               = table.TableName;
                string tableXmlName            = System.Xml.XmlConvert.EncodeLocalName(tableName);
                string path                    = PDFDataSchema.CombineElementNames(dsXmlName, tableXmlName);
                PDFDataItemCollection columns  = new PDFDataItemCollection(GetTableColumnSchema(path, table));
                PDFDataItem           topTable = new PDFDataItem(path, tableName, tableName, columns);
                topItems.Add(topTable);

                //TODO: Load child schemas
            }
            PDFDataSchema schema = new PDFDataSchema(dsName, new PDFDataItemCollection(topItems));

            return(schema);
        }
        /// <summary>
        /// Extracts a single schema data item for the provided data column
        /// </summary>
        /// <param name="path"></param>
        /// <param name="col"></param>
        /// <returns></returns>
        private static PDFDataItem GetColumnDataItem(string path, System.Data.DataColumn col)
        {
            string name         = col.ColumnName;
            string relativePath = System.Xml.XmlConvert.EncodeLocalName(name);
            string title        = string.IsNullOrEmpty(col.Caption) ? name : col.Caption;

            System.Xml.XmlNodeType nodetype;
            if (col.ColumnMapping == System.Data.MappingType.Hidden)
            {
                return(null);
            }
            else if (col.ColumnMapping == System.Data.MappingType.Attribute)
            {
                relativePath = "@" + relativePath;
                nodetype     = System.Xml.XmlNodeType.Attribute;
            }
            else if (col.ColumnMapping == System.Data.MappingType.SimpleContent)
            {
                relativePath = "text()";
                nodetype     = System.Xml.XmlNodeType.Text;
            }
            else if (col.ColumnMapping == System.Data.MappingType.Element)
            {
                nodetype      = System.Xml.XmlNodeType.Element;
                relativePath += "/text()";
            }
            else
            {
                throw new ArgumentOutOfRangeException("col.ColumnMapping");
            }

            string fullpath = PDFDataSchema.CombineElementNames(path, relativePath);

            PDFDataItem item = new PDFDataItem(fullpath, relativePath, name, title, nodetype, GetDataTypeFromSystemType(col));

            return(item);
        }