<?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>
views:
36answers:
3
A:
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>
]]>
Sohnee
2010-10-14 13:50:09
I'm looking for a function like json_encode that converts an array to JSON format, but in this case to XML
Cris Hong Kong CRISHK
2010-10-14 13:52:50
There isn't a built-in function for that, but there custom functions available... like this one... http://snipplr.com/view/3491/convert-php-array-to-xml-or-simple-xml-object-if-you-wish/
Sohnee
2010-10-15 06:54:39
+2
A:
Some quick Googling reveals this as your best option: http://www.tonymarston.net/php-mysql/dom.html
VoteyDisciple
2010-10-14 13:51:12
+1. And here's another one: http://www.redips.net/php/from-mysql-to-xml/
Tomalak
2010-10-14 13:56:10
A:
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
Māris Kiseļovs
2010-10-14 13:53:26