Has PHP a function to ENCODE a MySQL Table into XML like …? – Education Career Blog

<?xml>
<table>
    <row>
        <columnA>ValueA</columnA>
        <columnB>ValueB</columnB>
        <columnC>ValueC</columnC>
        <columnD>ValueD</columnD>
        <columnE>ValueE</columnE>
    </row>
    <row>
        <columnA>ValueA</columnA>
        <columnB>ValueB</columnB>
        <columnC>ValueC</columnC>
        <columnD>ValueD</columnD>
        <columnE>ValueE</columnE>
    </row>
...
</table>

,

Some quick Googling reveals this as your best option: http://www.tonymarston.net/php-mysql/dom.html

,

You could either use…

htmlentities($table, ENT_QUOTES);

Or you could use CDATA…

<!CDATA
<table>
    <row>
        <columnA>ValueA</columnA>
        <columnB>ValueB</columnB>
        <columnC>ValueC</columnC>
        <columnD>ValueD</columnD>
        <columnE>ValueE</columnE>
    </row>
    <row>
        <columnA>ValueA</columnA>
        <columnB>ValueB</columnB>
        <columnC>ValueC</columnC>
        <columnD>ValueD</columnD>
        <columnE>ValueE</columnE>
    </row>
...
</table>
>

,

I prefer using MDB2-Schema PEAR class to store SQL table structure in XML files.
http://pear.php.net/manual/en/package.database.mdb2-schema.dump.php

Leave a Comment