Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

How do I dump a database table into XML format?

by btrott (Parson)
on Apr 14, 2000 at 07:54 UTC ( [id://7594]=perlquestion: print w/replies, xml ) Need Help??

btrott has asked for the wisdom of the Perl Monks concerning the following question: (database programming)

How do I dump a database table into XML format?

Originally posted as a Categorized Question.

  • Comment on How do I dump a database table into XML format?

Replies are listed 'Best First'.
Re: How do I dump a database table into XML format?
by btrott (Parson) on Apr 14, 2000 at 07:56 UTC
    There's a module on CPAN designed exactly for this: DBIx::XML_RDB. You give it a SQL statement, and it executes the statement and dumps the returned rows and columns out in XML:
    use DBIx::XML_RDB; my $xmlout = DBIx::XML_RDB->new($datasource, "ODBC", $userid, $password, $dbname) or die "Failed to make new xmlout"; # tell DBIx::XML_RDB which data it should retrieve # (by using a SELECT statement) $xmlout->DoSql("select id, name from foo"); # write out the data in XML format print $xmlout->GetData;
    The module installs two utility scripts: sql2xml dumps SQL rows into XML, and xml2sql does the opposite.
Re: How do I dump a database table into XML format?
by silent11 (Vicar) on Jun 19, 2002 at 02:09 UTC
    If you are using MySQL try this from the command line.
    mysqldump --xml database_name table_name > out_file.xml
    -Silent11

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://7594]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-19 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found