MySQL Forums
Forum List  »  Connector/Node.js

Re: Export table data to XML file
Posted by: Erik Wetterberg
Date: July 09, 2007 02:34AM

Hi
I'm afraid you won't get much help from MySql built-in xml generation. mysql -xml will give a format somthing like this:

<row>
<field name="id">123</field>
<field name="code">3344552211</field>
<field name="colletion">the collection</field>
etc....
</row>

If you want to produce the xml in MySql, probably concat function is your best choice:

select concat('<collection name="',collection,'" description="',product_name,
'" status="',status ,'">')
from products

Then you can use PHP to add the initial xml tag and print it to file.

An alternative is of course to just fetch the data from MySql and use PHP to format the xml.

Erik Wetterberg


Gadgets for your Google homepage:
http://www.google.se/ig/authors?hl=en&author=erik.wetterberg@jubic.se



Edited 1 time(s). Last edit at 07/09/2007 02:40AM by Erik Wetterberg.

Options: ReplyQuote


Subject
Written By
Posted
February 05, 2009 04:58AM
Re: Export table data to XML file
July 09, 2007 02:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.