MySQL Forums
Forum List  »  Connector/Node.js

Re: Does mySQL generate XML ?
Posted by: Geri
Date: October 10, 2006 08:33AM

Yes, the mysql cmd line tool generates XML output with option '--xml'.

Unfortunately the output format is:

<resultset statment="...">
<field name=".."> ...field contents... </field>
...more fields
...more rows

with a simple DTD like:

<!ELEMENT resultset (row)+>
<!ATTLIST resultset
statement CDATA #IMPLIED>
<!ELEMENT row (field)+>
<!ELEMENT field (#PCDATA)+>

From an abstract point of view the following would be better (with a table 'user', for instance):

<city>Maria Enzersdorf</city>

With a more appealing DTD like (and even more appealing if this forum would know the <pre>-tag :-):

<!ELEMENT user (first_name, last_name, address)>
<!ELEMENT first_name (#PCDATA)>
<!ELEMENT last_name (#PCDATA)>
<!ELEMENT address (country, zip city)>
<!ELEMENT country (#PCDATA)>

This is how XML is meant to be used, as far as I understand it.


edit: corrected typos

Edited 2 time(s). Last edit at 10/10/2006 08:36AM by Geri .

Options: ReplyQuote

Written By
Re: Does mySQL generate XML ?
October 10, 2006 08:33AM
January 26, 2007 07:41AM
December 02, 2007 08:39PM
February 01, 2008 04:45PM

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.