[thelist] generating XML from MySQL tables

Garrett Coakley garrett at polytechnic.co.uk
Mon Nov 11 11:18:10 CST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 11 Nov 2002 12:58:34 -0300 Diego Barcia wrote:

> does anyone know how to generate XML automatically from a MySQL table,
> or tables, or database, under Win98, or if is that possible?

[snip]

> mysqldump --xml databasename [tables]

[snip]

> to do that, but I get a syntax error from MySql (ERROR 1064)... Also,
> I don't understand the syntax [tables] in that command. I guess if you
> have a db called 'db' and a table called 'sales' you should write:
> mysqldump --xml db [sales]? Or [tables] is optional?


You're close.

The general rule when looking at command line tools is that anything in
[]'s is an optional parameter (well, thats the way it is for a lot of
the GNU stuff). So if you wanted to dump out an xml feed of the 'user'
table from the 'mysql' database you would do:

mysql --xml -u <username> -p mysql user

Here that returns:

<?xml version="1.0"?>
        <user>
                <Host>localhost<Host>
                <User>martin<User>
                <Password>nottellinya<Password>
                <Select_priv>N<Select_priv>
                <Insert_priv>N<Insert_priv>
                <Update_priv>N<Update_priv>
                <Delete_priv>N<Delete_priv>
                <Create_priv>N<Create_priv>
                <Drop_priv>N<Drop_priv>
[snip]

HTH

G.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE9z+bl4AAXt40rqS4RAq5ZAJkB0h7Szz4Nhysi91l/cJZW1LY32gCfTb89
lVU6eTDXczi4Q0NNfiFU5Tg=
=Ormb
-----END PGP SIGNATURE-----



More information about the thelist mailing list