can there be any possibility of obtaining the output from the MySQL query straight to XML?

Im mentioning to something similar to MSSQL has with SQL-XML wordpress plugin, for instance:

SELECT * FROM table WHERE 1 FOR XML AUTO

returns text (or xml data key in MSSQL more specifically) which consists of an XML markup structure produced based on the posts within the table.

With SQL-XML there's also a choice of clearly determining the output XML structure such as this:

SELECT
  1       AS tag,
  NULL    AS parent,
  emp_id  AS [employee!1!emp_id],
  cust_id    AS [customer!2!cust_id],
  region    AS [customer!2!region]
 FROM table
 FOR XML EXPLICIT

which creates an XML code the following:

<employee emp_id='129'>
   <customer cust_id='107' region='Eastern'/>
</employee>

Have you got any clues how to do this in MySQL?

Thanks ahead of time for the solutions.

Using XML with MySQL appears to become a good starting point with assorted different methods for getting from MySQL query to XML.

In the article:

   use strict;
   use DBI;
   use XML::Generator::DBI;
   use XML::Handler::YAWriter;

   my $dbh = DBI->connect ("DBI:mysql:test",
                           "testuser", "testpass",
                           { RaiseError => 1, PrintError => 0});
   my $out = XML::Handler::YAWriter->new (AsFile => "-");
   my $gen = XML::Generator::DBI->new (
                                   Handler => $out,
                                   dbh => $dbh
                               );
   $gen->execute ("SELECT name, category FROM animal");
   $dbh->disconnect ();