Jump to content

XML generation


calmchess

Recommended Posts

I've got to ask, which part of doing this do you need help with? It is a trivial coding task (replace document_tag and data_tag with your choice of tag name) -

 

<?php
// execute your query here ...
echo '<?xml version="1.0" encoding="UTF-8" ?>'; // just in case the evil short open tags are on
echo "<document_tag>";
while($row = mysql_fetch_assoc($result)){
echo "<data_tag>{$row['column_name']}</data_tag>";
}
echo "</document_tag>";
?>

Link to comment
https://forums.phpfreaks.com/topic/207765-xml-generation/#findComment-1086123
Share on other sites

If you are writing the whole xml document based on data you have, it is simplest just to write the tags and data yourself.

 

However, if you are modifying or iterating over an existing xml document, you would likely want to use a more sophisticated method.

Link to comment
https://forums.phpfreaks.com/topic/207765-xml-generation/#findComment-1086159
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.