2

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?

eddy147
  • 4,853
  • 8
  • 38
  • 57

1 Answers1

1

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
GregD
  • 2,797
  • 3
  • 28
  • 39