eddy147
eddy147

Reputation: 4983

mysqldump without database name

Is it possible to dump data in xml format without the database name in the output?

If I dump output like this with the --xml option:

$>mysqldump --xml my_database_name my_table > my_table.xml

Then my output is something like

<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="my_database_name">
...

You can see the database name in the output which I do not want.

Is there an option to prevent that?

Upvotes: 2

Views: 3140

Answers (1)

GregD
GregD

Reputation: 2867

I don't think there is such option for the mysqldump command. After generating the XML file, you can always use a script to get rid off the database tags from the dump file. In Windows' PowerShell you could always use the following command:

${c:my_table.xml} -replace "`<database name=`"my_database_name`"`>" -replace "`<\database`>" > my_table_new.xml

Upvotes: 1

Related Questions