How To Return Query Output in XML Format


How To Return Query Output in XML Format? - MySQL FAQs - Command-Line End User Interface mysql



By default, "mysql" returns query output in text table format. If you want to receive query output in XML format, you need to use the "-X" command option. Here is a good tutorial exercise:

>cd \mysql\bin
>mysql -u root -X test

mysql> SELECT * FROM links;
<?xml version="1.0"?>
<resultset statement="SELECT * FROM links">
        <field name="id">1</field>
        <field name="name"></field>
        <field name="id">10</field>
        <field name="name"></field>
2 rows in set (0.00 sec)

2007-05-10, 4702👍, 0💬