SQL Server / MySQL to DTD (+XML)
You could try using MySQL's mysqldump utility.

There is an option to make mysqldump export in XML

[redwards@lw-lts-155 ~]$ mysqldump --help | grep xml
  -X, --xml           Dump a database as well formed XML.


In your case, you could dump the table mydb.mytable like this:

mysqldump --xml mydb mytable &gt; mytable.xml


EXAMPLE

For the given table

mysql&gt; show create table groupby\G
*************************** 1. row ***************************
       Table: groupby
Create Table: CREATE TABLE `groupby` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `num` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1
1 row in set (0.01 sec)

mysql&gt; select * from groupby;
+----+------------+
| id | num        |
+----+------------+
|  1 |  360370418 |
|  2 |  429187192 |
|  3 | 1064824747 |
|  4 | 1328623077 |
|  5 |  740702064 |
|  6 | 1071610692 |
|  7 |  428008187 |
|  8 |  279178462 |
|  9 |  360370418 |
| 10 |  429187192 |
| 11 | 1064824747 |
| 12 | 1328623077 |
| 13 |  740702064 |
| 14 | 1071610692 |
| 15 |  428008187 |
| 16 |  279178462 |
+----+------------+
16 rows in set (0.00 sec)

mysql&gt;


just mysqldump to a textfile.

Here is what the XML actually looks like

&lt;?xml version="1.0"?&gt;
&lt;mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;database name="eggyal"&gt;
        &lt;table_structure name="groupby"&gt;
                &lt;field Field="id" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" Comment="" /&gt;
                &lt;field Field="num" Type="int(11)" Null="YES" Key="" Extra="" Comment="" /&gt;
                &lt;key Table="groupby" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="16" Null="" Index_type="BTREE" Comment="" Index_comment="" /&gt;
                &lt;options Name="groupby" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="16" Avg_row_length="9" Data_length="144" Max_data_length="2533274790395903" Index_length="2048" Data_free="0" Auto_increment="17" Create_time="2012-11-26 22:39:22" Update_time="2012-11-26 22:39:22" Collation="latin1_swedish_ci" Create_options="" Comment="" /&gt;
        &lt;/table_structure&gt;
        &lt;table_data name="groupby"&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;1&lt;/field&gt;
                &lt;field name="num"&gt;360370418&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;2&lt;/field&gt;
                &lt;field name="num"&gt;429187192&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;3&lt;/field&gt;
                &lt;field name="num"&gt;1064824747&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;4&lt;/field&gt;
                &lt;field name="num"&gt;1328623077&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;5&lt;/field&gt;
                &lt;field name="num"&gt;740702064&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;6&lt;/field&gt;
                &lt;field name="num"&gt;1071610692&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;7&lt;/field&gt;
                &lt;field name="num"&gt;428008187&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;8&lt;/field&gt;
                &lt;field name="num"&gt;279178462&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;9&lt;/field&gt;
                &lt;field name="num"&gt;360370418&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;10&lt;/field&gt;
                &lt;field name="num"&gt;429187192&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;11&lt;/field&gt;
                &lt;field name="num"&gt;1064824747&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;12&lt;/field&gt;
                &lt;field name="num"&gt;1328623077&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;13&lt;/field&gt;
                &lt;field name="num"&gt;740702064&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;14&lt;/field&gt;
                &lt;field name="num"&gt;1071610692&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;15&lt;/field&gt;
                &lt;field name="num"&gt;428008187&lt;/field&gt;
        &lt;/row&gt;
        &lt;row&gt;
                &lt;field name="id"&gt;16&lt;/field&gt;
                &lt;field name="num"&gt;279178462&lt;/field&gt;
        &lt;/row&gt;
        &lt;/table_data&gt;
&lt;/database&gt;
&lt;/mysqldump&gt;


As for the DTD itself, you should look around StackOverflow and ServerFault

You could also XML dump just the structure using --no-data option

mysqldump --xml --no-data mydb mytable &gt; mytable.xml


which produces

&lt;?xml version="1.0"?&gt;
&lt;mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;database name="eggyal"&gt;
        &lt;table_structure name="groupby"&gt;
                &lt;field Field="id" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" Comment="" /&gt;
                &lt;field Field="num" Type="int(11)" Null="YES" Key="" Extra="" Comment="" /&gt;
                &lt;key Table="groupby" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="16" Null="" Index_type="BTREE" Comment="" Index_comment="" /&gt;
                &lt;options Name="groupby" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="16" Avg_row_length="9" Data_length="144" Max_data_length="2533274790395903" Index_length="2048" Data_free="0" Auto_increment="17" Create_time="2012-11-26 22:39:22" Update_time="2012-11-26 22:39:22" Collation="latin1_swedish_ci" Create_options="" Comment="" /&gt;
        &lt;/table_structure&gt;
&lt;/database&gt;
&lt;/mysqldump&gt;


Take that output and scult it into a DTD